aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2020-06-23 08:14:51 +0200
committerThomas Koenig <tkoenig@gcc.gnu.org>2020-06-23 08:14:51 +0200
commitabcde0a658e17dbbabcb396eaae5a3612e07d401 (patch)
tree4019dff4c6c8d2fd1db057987848b4bb69ea816e
parent384aa890255dc01ba6d6529b127975c2c9a49a3c (diff)
downloadgcc-abcde0a658e17dbbabcb396eaae5a3612e07d401.zip
gcc-abcde0a658e17dbbabcb396eaae5a3612e07d401.tar.gz
gcc-abcde0a658e17dbbabcb396eaae5a3612e07d401.tar.bz2
Handle AR_FULL vs. AR_FULL in dependency checking.
Previously, handling of full vs. full references failed to take AR_FULL vs. AR_FULL into account. A change in dependency checking in gcc 10 created a code path that could lead there; with this patch, this is now correctly handled. gcc/fortran/ChangeLog: 2020-06-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/95812 * dependency.c (ref_same_as_full_array): Handle case of AR_FULL vs. AR_FULL. gcc/testsuite/ChangeLog: 2020-06-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/95812 * gfortran.dg/dependency_59.f90: New test.
-rw-r--r--gcc/fortran/dependency.c2
-rw-r--r--gcc/testsuite/gfortran.dg/dependency_59.f9015
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index f6c6840..7edd5d9 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -2033,6 +2033,8 @@ ref_same_as_full_array (gfc_ref *full_ref, gfc_ref *ref)
return false;
if (ref->type != REF_ARRAY)
return false;
+ if (ref->u.ar.type == AR_FULL)
+ return true;
if (ref->u.ar.type != AR_SECTION)
return false;
diff --git a/gcc/testsuite/gfortran.dg/dependency_59.f90 b/gcc/testsuite/gfortran.dg/dependency_59.f90
new file mode 100644
index 0000000..90c6532
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dependency_59.f90
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! PR 95812 - this caused an ICE.
+! Test case by Jakub Jelinek.
+
+module test
+contains
+ subroutine foo()
+ integer :: a(3)
+ a = 1
+ print *, matmul(1*reshape(a,(/3,1/)), reshape((/1,1,1/),(/1,3/)))
+ end subroutine foo
+ subroutine bar()
+ call foo()
+ end subroutine bar
+end module test