summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/dependency_2.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/dependency_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/dependency_2.f9011
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/dependency_2.f90 b/gcc/testsuite/gfortran.dg/dependency_2.f90
new file mode 100644
index 000000000..1cbdec795
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dependency_2.f90
@@ -0,0 +1,11 @@
+! { dg-do run }
+! Tests the fix for PR20938 in which dependencies between equivalenced
+! arrays were not detected.
+!
+real, dimension (3) :: a = (/1., 2., 3./), b, c
+equivalence (a(2), b), (a(1), c)
+b = a;
+if (any(b .ne. (/1., 2., 3./))) call abort ()
+b = c
+if (any(b .ne. (/1., 1., 2./))) call abort ()
+end