diff options
author | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-09-14 16:21:33 +0000 |
---|---|---|
committer | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-09-14 16:21:33 +0000 |
commit | f3971b5ff430076b97a8c11365159f22d72981b2 (patch) | |
tree | 0a7932a9ccb55b151e6d55785626d8167e009edd /gcc | |
parent | ff6d39d5035e9396a67a108c2e03e5b7a7611e7f (diff) |
2019-09-14 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91642
* io.c (gfc_match_inquire): null() cannot be in an iolength inquire
list.
2019-09-14 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91642
* gfortran.dg/pr91642.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@275714 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/io.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr91642.f90 | 19 |
4 files changed, 41 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d718706e6e4..3ff20a25f6f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-09-14 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/91642 + * io.c (gfc_match_inquire): null() cannot be in an iolength inquire + list. + 2019-09-07 Paul Thomas <pault@gcc.gnu.org> Backport from mainline diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index b3d8696c030..9bee9094e7f 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -4583,6 +4583,17 @@ gfc_match_inquire (void) if (m == MATCH_NO) goto syntax; + for (gfc_code *c = code; c; c = c->next) + if (c->expr1 && c->expr1->expr_type == EXPR_FUNCTION + && c->expr1->symtree && c->expr1->symtree->n.sym->attr.function + && !c->expr1->symtree->n.sym->attr.external + && strcmp (c->expr1->symtree->name, "null") == 0) + { + gfc_error ("NULL() near %L cannot appear in INQUIRE statement", + &c->expr1->where); + goto cleanup; + } + new_st.op = EXEC_IOLENGTH; new_st.expr1 = inquire->iolength; new_st.ext.inquire = inquire; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9a424e463e4..f5d620a9ce0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-14 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/91642 + * gfortran.dg/pr91642.f90: New test. + 2019-09-11 Eric Botcazou <ebotcazou@adacore.com> * gcc.target/sparc/20161111-1.c: XFAIL redundant zero-extension test. diff --git a/gcc/testsuite/gfortran.dg/pr91642.f90 b/gcc/testsuite/gfortran.dg/pr91642.f90 new file mode 100644 index 00000000000..8c41cd2dae0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr91642.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! PR fortran/91642 +! Code contributed by Gerhard Steinmetz +program p + integer i + integer :: iol + integer, external :: null + i = 0 + inquire (iolength=iol) i, null() + if (iol == 4) stop 1 +end + +subroutine q + integer i + integer :: iol + i = 0 + inquire (iolength=iol) i, null() ! { dg-error "cannot appear in INQUIRE" } + if (iol == 4) stop 1 +end |