aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/equiv_constraint_5.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.dg/equiv_constraint_5.f90')
-rw-r--r--gcc-4.9/gcc/testsuite/gfortran.dg/equiv_constraint_5.f9031
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/equiv_constraint_5.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/equiv_constraint_5.f90
new file mode 100644
index 000000000..1f7dddc84
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gfortran.dg/equiv_constraint_5.f90
@@ -0,0 +1,31 @@
+! { dg-do compile }
+! { dg-options "-O0" }
+! PR20902 - Overlapping initializers in an equivalence block must
+! have the same value.
+!
+! The code was replaced completely after the fix for PR30875, which
+! is a repeat of the original and comes from the same contributor.
+! The fix for 20902 was wrong.
+!
+! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
+!
+ TYPE T1
+ sequence
+ integer :: i=1
+ END TYPE T1
+ TYPE T2 ! OK because initializers are equal
+ sequence
+ integer :: i=1
+ END TYPE T2
+ TYPE T3
+ sequence
+ integer :: i=2 ! { dg-error "Overlapping unequal initializers" }
+ END TYPE T3
+ TYPE(T1) :: a1
+ TYPE(T2) :: a2
+ TYPE(T3) :: a3
+ EQUIVALENCE (a1, a2)
+ EQUIVALENCE (a1, a3)
+ write(6, *) a1, a2, a3
+END
+