2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / dec_union_11.f90
blob3ff4b49b62f1a4bdb10c805da14febb20d2028b2
1 ! { dg-do compile }
2 ! { dg-options "-g -fdec-structure" }
4 ! Test a regression where typespecs of unions containing character buffers of
5 ! different lengths where copied, resulting in a bad gimple tree state.
8 subroutine sub2 (otherbuf)
9 integer, parameter :: L_bbuf = 65536
10 integer, parameter :: L_bbuf2 = 24
12 structure /buffer2/
13 union
14 map
15 character(L_bbuf2) sbuf
16 end map
17 end union
18 end structure
19 structure /buffer/
20 union
21 map
22 character(L_bbuf) sbuf
23 end map
24 end union
25 end structure
27 record /buffer/ buf1
28 record /buffer2/ buf2
29 common /c/ buf1, buf2
31 record /buffer2/ otherbuf
32 end subroutine
34 subroutine sub()
35 integer, parameter :: L_bbuf = 65536
36 integer, parameter :: L_bbuf2 = 24
38 structure /buffer2/
39 union
40 map
41 character(L_bbuf2) sbuf
42 end map
43 end union
44 end structure
45 structure /buffer/
46 union
47 map
48 character(L_bbuf) sbuf
49 end map
50 end union
51 end structure
53 record /buffer/ buf1
54 record /buffer2/ buf2
55 common /c/ buf1, buf2
57 call sub2 (buf1) ! { dg-warning "Type mismatch" }
58 return
59 end subroutine
61 call sub()
63 end