2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / equiv_constraint_5.f90
blob199b9548900a876acc5938f987c47256f215c58b
1 ! { dg-do compile }
2 ! { dg-options "-O0" }
3 ! PR20902 - Overlapping initializers in an equivalence block must
4 ! have the same value.
6 ! The code was replaced completely after the fix for PR30875, which
7 ! is a repeat of the original and comes from the same contributor.
8 ! The fix for 20902 was wrong.
10 ! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
12 TYPE T1
13 sequence
14 integer :: i=1
15 END TYPE T1
16 TYPE T2 ! OK because initializers are equal
17 sequence
18 integer :: i=1
19 END TYPE T2
20 TYPE T3
21 sequence
22 integer :: i=2
23 END TYPE T3
24 TYPE(T1) :: a1
25 TYPE(T2) :: a2
26 TYPE(T3) :: a3
27 EQUIVALENCE (a1, a2)
28 EQUIVALENCE (a1, a3) ! { dg-error "Overlapping unequal initializers" }
29 write(6, *) a1, a2, a3
30 END