re PR fortran/85507 (ICE in gfc_dep_resolver, at fortran/dependency.c:2258)
authorAndre Vehreschild <vehre@gcc.gnu.org>
Sun, 6 May 2018 11:19:31 +0000 (13:19 +0200)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Sun, 6 May 2018 11:19:31 +0000 (13:19 +0200)
gcc/fortran/ChangeLog:

2018-05-06  Andre Vehreschild  <vehre@gcc.gnu.org>

PR fortran/85507
* dependency.c (gfc_dep_resolver): Revert looking at coarray dimension
introduced by r259385.
* trans-intrinsic.c (conv_caf_send): Always report a dependency for
same variables in coarray assignments.

gcc/testsuite/ChangeLog:

2018-05-06  Andre Vehreschild  <vehre@gcc.gnu.org>

PR fortran/85507
* gfortran.dg/coarray_dependency_1.f90: New test.
* gfortran.dg/coarray_lib_comm_1.f90: Fix counting caf-expressions.

From-SVN: r259974

gcc/fortran/ChangeLog
gcc/fortran/dependency.c
gcc/fortran/trans-intrinsic.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/coarray_dependency_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90

index 787f0ae22ec5f676f8c58301999e7d9a38736e81..b94feb987fa168c87c5b391c4dd6692db0a21210 100644 (file)
@@ -1,3 +1,11 @@
+2018-05-06  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+       PR fortran/85507
+       * dependency.c (gfc_dep_resolver): Revert looking at coarray dimension
+       introduced by r259385.
+       * trans-intrinsic.c (conv_caf_send): Always report a dependency for
+       same variables in coarray assignments.
+
 2018-05-02  Tom de Vries  <tom@codesourcery.com>
 
        PR libgomp/82428
index 3e14ddc25d86300a19fb844f0deee618b890a609..a0bbd584947fb49371862f8554b8760c56af7fc1 100644 (file)
@@ -2238,9 +2238,8 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse)
            break;
 
          /* Exactly matching and forward overlapping ranges don't cause a
-            dependency, when they are not part of a coarray ref.  */
-         if (fin_dep < GFC_DEP_BACKWARD
-             && lref->u.ar.codimen == 0 && rref->u.ar.codimen == 0)
+            dependency.  */
+         if (fin_dep < GFC_DEP_BACKWARD)
            return 0;
 
          /* Keep checking.  We only have a dependency if
index 00edd447bb2a1d6f6980eefe0c6c32a230709dda..87b3ca72c05a5498650c44c2eba590035b36ce6b 100644 (file)
@@ -1860,7 +1860,7 @@ conv_caf_send (gfc_code *code) {
 
   lhs_expr = code->ext.actual->expr;
   rhs_expr = code->ext.actual->next->expr;
-  may_require_tmp = gfc_check_dependency (lhs_expr, rhs_expr, false) == 0
+  may_require_tmp = gfc_check_dependency (lhs_expr, rhs_expr, true) == 0
                    ? boolean_false_node : boolean_true_node;
   gfc_init_block (&block);
 
index bba9294c2d6430608d50e3a4d3b6ab59e83155a0..3390087e3275d3cc956d02be8a6d6eea3dfd6bfa 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-06  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+       PR fortran/85507
+       * gfortran.dg/coarray_dependency_1.f90: New test.
+       * gfortran.dg/coarray_lib_comm_1.f90: Fix counting caf-expressions.
+
 2018-05-04  Pekka Jääskeläinen  <pekka.jaaskelainen@parmance.com>
 
        * testsuite/brig.dg/test/gimple/smoke_test.hsail: Fix the test
diff --git a/gcc/testsuite/gfortran.dg/coarray_dependency_1.f90 b/gcc/testsuite/gfortran.dg/coarray_dependency_1.f90
new file mode 100644 (file)
index 0000000..dc4cbac
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib -lcaf_single" }
+!
+! Check that reffing x on both sides of a coarray send does not ICE. 
+! PR 85507
+
+program check_dependency
+  integer :: x[*]
+  x[42] = x
+end program check_dependency
+
index a7567af7b8f33ccccf7acaa64e1c78e02b328481..171a27bd4c36e331bc222a8c987d1ca5f67ba8fa 100644 (file)
@@ -38,9 +38,8 @@ B(1:5) = B(3:7)
 if (any (A-B /= 0)) STOP 4
 end
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 0, 0B\\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 1, 0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 1, 0B\\\);" 2 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 1, 0B\\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.1, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) b, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 0, 0B\\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 1, 0B\\\);" 1 "original" } }