Handle REF_INQUIRY for dependency checking.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Wed, 1 Jan 2020 21:40:35 +0000 (21:40 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Wed, 1 Jan 2020 21:40:35 +0000 (21:40 +0000)
2020-01-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/93113
* dependency.c (gfc_dep_resolver): Handle REF_INQUIRY in switch
for ref types.

2020-01-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/93113
* gfortran.dg/dependency_58.f90: New test.

From-SVN: r279821

gcc/fortran/ChangeLog
gcc/fortran/dependency.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/dependency_58.f90 [new file with mode: 0644]

index e6180d97712be16378f3bf37eeb4e5634b15655c..ba363f88261a9e658a361afea24d967c5ca5f4f8 100644 (file)
@@ -1,3 +1,9 @@
+2020-01-01  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/93113
+       * dependency.c (gfc_dep_resolver): Handle REF_INQUIRY in switch
+       for ref types.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
        Update copyright years.
index 35932562490028a57791adf2287e54040ee76af8..f6c68409e684d30fb236ed37fc60bfa31565eac2 100644 (file)
@@ -2286,6 +2286,12 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
             subsequent references also overlap.  */
          break;
 
+       case REF_INQUIRY:
+         if (lref->u.i != rref->u.i)
+           return 0;
+
+         break;
+
        default:
          gcc_unreachable ();
        }
index ee7003f32bc0768bb50a08e4d0c50be76678d202..12f934d6571e8adb71ae348fc4328ebc03e991ab 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-01  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/93113
+       * gfortran.dg/dependency_58.f90: New test.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
        Update copyright years.
diff --git a/gcc/testsuite/gfortran.dg/dependency_58.f90 b/gcc/testsuite/gfortran.dg/dependency_58.f90
new file mode 100644 (file)
index 0000000..8b156e5
--- /dev/null
@@ -0,0 +1,33 @@
+! { dg-do run }
+! { dg-additional-options "-ffrontend-optimize -Warray-temporaries" }
+! PR 93113 - this used to ICE, and should not generate a temporary.
+program main
+  integer, parameter :: n = 10
+  complex, dimension(n,n) :: a, b, c
+  real, dimension(n,n) :: r
+  call random_number (r)
+  c%re = r
+  call random_number (r)
+  c%im = r
+
+  a = c
+  b = c
+  b%re = a%re - 0.5
+  b%im = a%im - 0.5
+  a%re = a%re - 0.5
+  a%im = a%im - 0.5
+  if (any (a /= b)) stop 1
+  b%im = a%re
+  a%im = a%re
+  if (any (a /= b)) stop 2
+  a = c
+  b = c
+  b(2:n,:)%re = a(1:n-1,:)%re
+  a(2:n,:)%re = a(1:n-1,:)%re
+  if (any (a /= b)) stop 3
+  a = c
+  b = c
+  b(1:n-1,:)%im = a(2:,:)%im
+  a(1:n-1,:)%im = a(2:,:)%im
+  if (any (a /= b)) stop 3
+end program main