xref: /llvm-project/flang/test/Semantics/data12.f90 (revision 6c1ac141d3c98af9738bc77fcb55602cbff7751f)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2type :: t1
3  sequence
4  integer :: m = 123
5  integer :: pad
6end type
7type :: t2
8  sequence
9  integer :: n = 123
10  integer :: pad
11end type
12type :: t3
13  sequence
14  integer :: k = 234
15  integer :: pad
16end type
17!ERROR: Distinct default component initializations of equivalenced objects affect 'x1a%m' more than once
18type(t1) :: x1a
19!ERROR: Distinct default component initializations of equivalenced objects affect 'x2a%n' more than once
20type(t2) :: x2a
21!ERROR: Distinct default component initializations of equivalenced objects affect 'x3%k' more than once
22type(t3), save :: x3
23!ERROR: Explicit initializations of equivalenced objects affect 'ja(2_8)' more than once
24!ERROR: Explicit initializations of equivalenced objects affect 'ka(1_8)' more than once
25integer :: ja(2), ka(2)
26data ja/345, 456/
27data ka/456, 567/
28equivalence(x1a, x2a, x3)
29! Same value: no error
30type(t1) :: x1b
31type(t2) :: x2b
32equivalence(x1b, x2b)
33equivalence(ja(2),ka(1))
34end
35