1! { dg-do compile }
2! { dg-options "-O0" }
3! PR20902 - Overlapping initializers in an equivalence block must
4! have the same value.
5!
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.
9!
10! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
11!
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 ! { dg-error "Overlapping unequal initializers" }
23  END TYPE T3
24  TYPE(T1) :: a1
25  TYPE(T2) :: a2
26  TYPE(T3) :: a3
27  EQUIVALENCE (a1, a2)
28  EQUIVALENCE (a1, a3)
29  write(6, *) a1, a2, a3
30END
31
32