PR ipa/83051
[official-gcc.git] / gcc / testsuite / gfortran.dg / dec_init_3.f90
blob253cd9b2fa2da50c9536b4d9563d257320a24901
1 ! { dg-do run }
2 ! { dg-options "-fdec-structure -finit-derived -finit-local-zero" }
4 ! Test -finit-derived with DEC structure and union.
7 subroutine dummy(i1,r1,c1,l1,i2,r2,c2,l2)
8 implicit none
9 integer, intent(in) :: i1
10 real, intent(in) :: r1
11 character, intent(in) :: c1
12 logical, intent(in) :: l1
13 integer, intent(inout) :: i2
14 real, intent(inout) :: r2
15 character, intent(inout) :: c2
16 logical, intent(inout) :: l2
17 print *, i1, i2, l1, l2, ichar(c1), ichar(c2), r1, r2
18 if ( i1 .ne. 0 .or. i2 .ne. 0 ) call abort()
19 if ( l1 .or. l2 ) call abort()
20 if ( c1 .ne. achar(0) .or. c2 .ne. achar(0) ) call abort()
21 if ( r1 .ne. 0.0 .or. r2 .ne. 0.0 ) call abort()
22 end subroutine
24 subroutine sub
25 structure /s1/
26 integer i
27 end structure
29 structure /s2/
30 union
31 map
32 integer m11
33 real m12
34 character m13
35 logical m14
36 end map
37 map
38 logical m21
39 character m22
40 real m23
41 integer m24
42 end map
43 map
44 character(32) s
45 record /s1/ r
46 end map
47 end union
48 end structure
49 record /s2/ x
50 call dummy (x.m11, x.m12, x.m13, x.m14, x.m24, x.m23, x.m22, x.m21)
51 print *, x.r.i
52 if ( x.r.i .ne. 0 ) then
53 call abort ()
54 endif
55 end subroutine
57 call sub
59 end