]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/85895 (ICE in gfc_conv_array_ref, at fortran/trans-array.c:3518)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 24 May 2018 22:28:33 +0000 (22:28 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 24 May 2018 22:28:33 +0000 (22:28 +0000)
2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/85895
* resolve.c (resolve_sync): Resolve expression before checking for
an error.

2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/85895

* gfortran.dg/coarray_3.f90: Fix invalid testcase.
* gfortran.dg/pr85895.f90: New test.

From-SVN: r260696

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/coarray_3.f90
gcc/testsuite/gfortran.dg/pr85895.f90 [new file with mode: 0644]

index 00abe73f15a7a9ccf8f53b2205e0613aee8aa33a..a65470c4447bed812b4de4ca425b543715eb42d1 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/85895
+       * resolve.c (resolve_sync): Resolve expression before checking for
+       an error.
+
 2018-05-22  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/85841
index 13374dddf1dc7a891c89612bf48e94ffc511c6ca..a53253ea88b2b7e950eb8414e99288215fa6910f 100644 (file)
@@ -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))
index 4e77177e229569fd98380e9f993ec818a5af73fc..707db425ec5062b299af98126569e9a3391c64c4 100644 (file)
@@ -1,3 +1,10 @@
+2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/85895
+
+       * gfortran.dg/coarray_3.f90: Fix invalid testcase.
+       * gfortran.dg/pr85895.f90: New test.
+
 2018-05-24  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/avx512f-vcvtusi2sd64-1.c: Update scan string.
index aba4eb1bc847b04c07f644bc43247712a500ce74..d152ce1b2bdcb023aa28e8b94eb78e831fc0f402 100644 (file)
@@ -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 (file)
index 0000000..184266e
--- /dev/null
@@ -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