aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/equiv_constraint_5.f90
blob: 1f7dddc846be63e03ed9d9d5f1bd92fbaf9fa05c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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