re PR fortran/71068 (ICE in check_data_variable(): Bad expression)
authorTobias Burnus <burnus@net-b.de>
Tue, 21 Jun 2016 18:36:25 +0000 (20:36 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Tue, 21 Jun 2016 18:36:25 +0000 (20:36 +0200)
2016-06-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/71068
        * resolve.c (resolve_function): Don't resolve caf_get/caf_send.
        (check_data_variable): Strip-off caf_get before checking.

        PR fortran/71068
        * gfortran.dg/coarray/data_1.f90: New.

From-SVN: r237656

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

index bfd3d4ef6f714d4762f76562caf6f2d7c3c168fc..317fee5b6be94516e89ca6ebe266f6a5e4fbb581 100644 (file)
@@ -1,6 +1,12 @@
+2016-06-21  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/71068
+       * resolve.c (resolve_function): Don't resolve caf_get/caf_send.
+       (check_data_variable): Strip-off caf_get before checking.
+
 2016-06-20  Tobias Burnus  <burnus@net-b.de>
 
-       fortran/71194
+       PR fortran/71194
        * trans-expr.c (gfc_trans_pointer_assignment): Correctly handle
        RHS pointer functions.
 
index 77f8c10bf7ec45ef1871956ec8d5f52ea93e0490..4378313975247936e31631b2772a1faf5252f0e6 100644 (file)
@@ -2923,6 +2923,13 @@ resolve_function (gfc_expr *expr)
   if (gfc_is_proc_ptr_comp (expr))
     return true;
 
+  /* Avoid re-resolving the arguments of caf_get, which can lead to inserting
+     another caf_get.  */
+  if (sym && sym->attr.intrinsic
+      && (sym->intmod_sym_id == GFC_ISYM_CAF_GET
+         || sym->intmod_sym_id == GFC_ISYM_CAF_SEND))
+    return true;
+
   if (sym && sym->attr.intrinsic
       && !gfc_resolve_intrinsic (sym, &expr->where))
     return false;
@@ -14495,6 +14502,10 @@ check_data_variable (gfc_data_variable *var, locus *where)
   mpz_init_set_si (offset, 0);
   e = var->expr;
 
+  if (e->expr_type == EXPR_FUNCTION && e->value.function.isym
+      && e->value.function.isym->id == GFC_ISYM_CAF_GET)
+    e = e->value.function.actual->expr;
+
   if (e->expr_type != EXPR_VARIABLE)
     gfc_internal_error ("check_data_variable(): Bad expression");
 
index ffb16146c31252ad331c7c6f763f7527cffec476..7f5720997eb451a67a23cbf27197d35b964f99ea 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-21  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/71068
+       * gfortran.dg/coarray/data_1.f90: New.
+
 2016-06-21  Wilco Dijkstra  <wdijkstr@arm.com>
 
        * gcc.target/aarch64/advsimd-intrinsics/vrnd.c
diff --git a/gcc/testsuite/gfortran.dg/coarray/data_1.f90 b/gcc/testsuite/gfortran.dg/coarray/data_1.f90
new file mode 100644 (file)
index 0000000..d68ac14
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+! PR fortran/71068
+!
+! Contributed by Gerhard Steinmetz
+!
+program p
+   integer :: a(2)[*]
+   data a(1)[1] /1/  ! { dg-error "cannot have a coindex" }
+   data a(2)[1] /2/  ! { dg-error "cannot have a coindex" }
+end