arm: Add .type and .size to __gnu_cmse_nonsecure_call [PR115360]
[official-gcc.git] / gcc / testsuite / gfortran.dg / dec_init_4.f90
blob867d9862e216b4edea7870809ca9039458fe8f49
1 ! { dg-do run }
2 ! { dg-options "-fdec-structure -finit-derived -finit-local-zero" }
4 ! Test a UNION with explicit initialization and -finit-derived.
7 subroutine sub
8 structure /s2/
9 integer(4) :: i = 8
10 union ! U7
11 map
12 integer(4) :: x = 1600
13 integer(4) :: y = 1800
14 end map
15 map
16 integer(2) a, b, c, d, e, f, g, h
17 end map
18 end union
19 end structure
20 record /s2/ r2
22 ! Initialized unions
23 if ( r2.i .ne. 8 ) then
24 print *, 'structure init'
25 STOP 1
26 endif
28 ! Explicit initializations
29 if ( r2.x .ne. 1600 .or. r2.y .ne. 1800) then
30 r2.x = r2.y
31 print *, 'union explicit init'
32 STOP 2
33 endif
35 ! Initialization from -finit-derived
36 if ( r2.h .ne. 0 ) then
37 r2.h = 135
38 print *, 'union default init'
39 STOP 3
40 endif
42 end subroutine
44 ! Initialization expressions
45 structure /s3/
46 integer(4) :: i = 8
47 union ! U7
48 map
49 integer(4) :: x = 1600
50 integer(4) :: y = 1800
51 end map
52 map
53 integer(2) a, b, c, d, e
54 end map
55 end union
56 end structure
58 record /s3/ r3
60 ! Initialized unions
61 if ( r3.i .ne. 8 ) then
62 print *, 'structure init'
63 STOP 4
64 endif
66 ! Explicit initializations
67 if ( r3.x .ne. 1600 .or. r3.y .ne. 1800) then
68 r3.x = r3.y
69 print *, 'union explicit init'
70 STOP 5
71 endif
73 ! Initialization from -finit-derived
74 if ( r3.e .ne. 0 ) then
75 r3.e = 135
76 print *, 'union default init'
77 STOP 6
78 endif
80 end