From: Andre Vehreschild Date: Sun, 6 May 2018 11:19:31 +0000 (+0200) Subject: re PR fortran/85507 (ICE in gfc_dep_resolver, at fortran/dependency.c:2258) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8309b221a0fce1cb7dc96d4e7df33bc761ccded9;p=gcc.git re PR fortran/85507 (ICE in gfc_dep_resolver, at fortran/dependency.c:2258) gcc/fortran/ChangeLog: 2018-05-06 Andre Vehreschild 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 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 787f0ae22ec..b94feb987fa 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2018-05-06 Andre Vehreschild + + 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 PR libgomp/82428 diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c index 3e14ddc25d8..a0bbd584947 100644 --- a/gcc/fortran/dependency.c +++ b/gcc/fortran/dependency.c @@ -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 diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 00edd447bb2..87b3ca72c05 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bba9294c2d6..3390087e327 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-05-06 Andre Vehreschild + + 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 * 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 index 00000000000..dc4cbacba1e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_dependency_1.f90 @@ -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 + diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 index a7567af7b8f..171a27bd4c3 100644 --- a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 @@ -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" } }