RISC-V: Refactor Dynamic LMUL codes
[official-gcc.git] / gcc / testsuite / gfortran.dg / dec_union_1.f90
blob689628c66c543e8c433e4e83b36b024c2d27345b
1 ! { dg-do run }
2 ! { dg-options "-fdec-structure" }
4 ! Test whether union backend declarations are corrently _not_ copied when they
5 ! are not in fact equal. The structure defined in sub() is seen later, but
6 ! where siz has a different value.
9 subroutine aborts (s)
10 character(*), intent(in) :: s
11 print *, s
12 STOP 1
13 end subroutine
15 subroutine sub ()
16 integer, parameter :: siz = 1024
17 structure /s6/
18 union ! U0
19 map ! M0
20 integer ibuf(siz)
21 end map
22 map ! M1
23 character(8) cbuf(siz)
24 end map
25 map ! M2
26 real rbuf(siz)
27 end map
28 end union
29 end structure
30 record /s6/ r6
31 r6.ibuf(1) = int(z'badbeef')
32 r6.ibuf(2) = int(z'badbeef')
33 end subroutine
35 ! Repeat definition from subroutine sub with different size parameter.
36 ! If the structure definition is copied here the stack may get messed up.
37 integer, parameter :: siz = 65536
38 structure /s6/
39 union ! U12
40 map
41 integer ibuf(siz)
42 end map
43 map
44 character(8) cbuf(siz)
45 end map
46 map
47 real rbuf(siz)
48 end map
49 end union
50 end structure
52 record /s6/ r6
53 integer :: r6_canary = 0
55 ! Copied type declaration - this should not cause problems
56 i = 1
57 do while (i < siz)
58 r6.ibuf(i) = int(z'badbeef')
59 i = i + 1
60 end do
62 if ( r6_canary .ne. 0 ) then
63 call aborts ('copied decls: overflow')
64 endif
66 end