From: Steven G. Kargl Date: Sat, 19 Jan 2019 21:18:26 +0000 (+0000) Subject: re PR fortran/77960 (ICE in gfc_conv_ss_startstride, at fortran/trans-array.c:3966) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5131b898e57d363420c0af03a4edd052b5c3fa05;p=gcc.git re PR fortran/77960 (ICE in gfc_conv_ss_startstride, at fortran/trans-array.c:3966) 2019-01-19 Steven G. Kargl PR fortran/77960 * io.c (match_io_element): input-item cannot be an external function. 2019-01-19 Steven G. Kargl PR fortran/77960 * gfortran.dg/pr77960.f90: New test. From-SVN: r268097 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c55cd7515f3..6c95a879b24 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2019-01-19 Steven G. Kargl + + PR fortran/77960 + * io.c (match_io_element): input-item cannot be an external function. + 2018-01-19 Thomas Koenig Paul Thomas diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 4ea37a331ca..fce9228c302 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -3610,6 +3610,16 @@ match_io_element (io_kind k, gfc_code **cpp) m = gfc_match_variable (&expr, 0); if (m == MATCH_NO) gfc_error ("Expected variable in READ statement at %C"); + + if (m == MATCH_YES + && expr->expr_type == EXPR_VARIABLE + && expr->symtree->n.sym->attr.external) + { + gfc_error ("Expecting variable or io-implied-do at %L", + &expr->where); + m = MATCH_ERROR; + } + } else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 286614dff12..f3c66ee318d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-19 Steven G. Kargl + + PR fortran/77960 + * gfortran.dg/pr77960.f90: New test. + 2018-01-19 Thomas Koenig Paul Thomas diff --git a/gcc/testsuite/gfortran.dg/pr77960.f90 b/gcc/testsuite/gfortran.dg/pr77960.f90 new file mode 100644 index 00000000000..6d9240e7384 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr77960.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! PR fortran/77960 + procedure(g), pointer :: f + f => g + read(99) f ! { dg-error "Expecting variable" } +contains + function g() result(z) + integer :: z(2) + z = 1 + end +end + +subroutine bar(x) + integer, external :: x + read(*,*) x ! { dg-error "Expecting variable" } +end subroutine