From: Steven G. Kargl Date: Thu, 24 May 2018 22:28:33 +0000 (+0000) Subject: re PR fortran/85895 (ICE in gfc_conv_array_ref, at fortran/trans-array.c:3518) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8909fee2891ba084a2b8d317e864b3cf4c1e6b01;p=gcc.git re PR fortran/85895 (ICE in gfc_conv_array_ref, at fortran/trans-array.c:3518) 2018-05-24 Steven G. Kargl PR fortran/85895 * resolve.c (resolve_sync): Resolve expression before checking for an error. 2018-05-24 Steven G. Kargl PR fortran/85895 * gfortran.dg/coarray_3.f90: Fix invalid testcase. * gfortran.dg/pr85895.f90: New test. From-SVN: r260696 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 00abe73f15a..a65470c4447 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-05-24 Steven G. Kargl + + PR fortran/85895 + * resolve.c (resolve_sync): Resolve expression before checking for + an error. + 2018-05-22 Janus Weil PR fortran/85841 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 13374dddf1d..a53253ea88b 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -9527,6 +9527,7 @@ resolve_sync (gfc_code *code) } /* Check STAT. */ + gfc_resolve_expr (code->expr2); if (code->expr2 && (code->expr2->ts.type != BT_INTEGER || code->expr2->rank != 0 || code->expr2->expr_type != EXPR_VARIABLE)) @@ -9534,6 +9535,7 @@ resolve_sync (gfc_code *code) &code->expr2->where); /* Check ERRMSG. */ + gfc_resolve_expr (code->expr3); if (code->expr3 && (code->expr3->ts.type != BT_CHARACTER || code->expr3->rank != 0 || code->expr3->expr_type != EXPR_VARIABLE)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e77177e229..707db425ec5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-05-24 Steven G. Kargl + + PR fortran/85895 + + * gfortran.dg/coarray_3.f90: Fix invalid testcase. + * gfortran.dg/pr85895.f90: New test. + 2018-05-24 Uros Bizjak * gcc.target/i386/avx512f-vcvtusi2sd64-1.c: Update scan string. diff --git a/gcc/testsuite/gfortran.dg/coarray_3.f90 b/gcc/testsuite/gfortran.dg/coarray_3.f90 index aba4eb1bc84..d152ce1b2bd 100644 --- a/gcc/testsuite/gfortran.dg/coarray_3.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_3.f90 @@ -13,7 +13,7 @@ end critical fkl ! { dg-error "Expecting END PROGRAM" } sync all (stat=1) ! { dg-error "Syntax error in SYNC ALL" } sync all ( stat = n,stat=k) ! { dg-error "Redundant STAT" } -sync memory (errmsg=str) +sync memory (errmsg=str) ! { dg-error "must be a scalar CHARACTER variable" } sync memory (errmsg=n) ! { dg-error "must be a scalar CHARACTER variable" } sync images (*, stat=1.0) ! { dg-error "Syntax error in SYNC IMAGES" } sync images (-1) ! { dg-error "must between 1 and num_images" } diff --git a/gcc/testsuite/gfortran.dg/pr85895.f90 b/gcc/testsuite/gfortran.dg/pr85895.f90 new file mode 100644 index 00000000000..184266e5ec8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr85895.f90 @@ -0,0 +1,17 @@ +! { dg-do compile } +! { dg-options "-fcoarray=lib" } +! PR fortran/85895 +subroutine p + character(80) :: c(2) + sync memory (errmsg=c) ! { dg-error "scalar CHARACTER variable" } +end subroutine p + +subroutine q + character(80) :: c(2) + sync memory (errmsg=c(1:2)) ! { dg-error "scalar CHARACTER variable" } +end subroutine q + +subroutine r + character(80) :: c(2) + sync memory (errmsg=c(1)) +end subroutine r