blob: 31059c468802308da683864d44119b7ec6a6ee69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
! { dg-do run }
! { dg-options "-fdec-structure" }
!
! sub0 and sub1 test a regression where calling gfc_use_derived from
! gfc_find_component on the structure type symbol being parsed caused the
! symbol to be freed and swapped for the previously seen type symbol, leaving
! dangling pointers and causing all sorts of mayhem.
!
subroutine sub0 (u)
structure /s/
union ! U0
map ! M0
integer i
end map
end union
end structure
record /s/ u
u.i = 0
end subroutine sub0
subroutine sub1 ()
structure /s/
union ! U1
map ! M1
integer i
end map
end union
end structure
record /s/ u
interface ! matches the declaration of sub0 above
subroutine sub0 (u)
structure /s/
union ! U2
map ! M2
integer i ! gfc_find_component should not call gfc_use_derived
end map ! here, otherwise this structure's type symbol is freed
end union ! out from under it
end structure
record /s/ u
end subroutine sub0
end interface
call sub0(u)
end subroutine
! If sub0 and sub1 aren't used they may be omitted
structure /s/
union ! U1
map ! M3
integer i
end map
end union
end structure
record /s/ u
call sub0(u)
call sub1()
end
|