Debian Codegraph @

gcc/testsuite/gfortran.dg/realloc_on_assign_32.f90

raw
1 ! { dg-do run }
2 !
3 ! Test the fix for PR88980 in which the 'span' field if the descriptor
4 ! for 'Items' was not set, causing the assignment to segfault.
5 !
6 ! Contributed by Antony Lewis <[email protected]>
7 !
8 program tester
9 call gbug
10 contains
11 subroutine gbug
12 type TNameValue
13 character(LEN=:), allocatable :: Name
14 end type TNameValue
15
16 type TNameValue_pointer
17 Type(TNameValue), allocatable :: P
18 end type TNameValue_pointer
19
20 Type TType
21 type(TNameValue_pointer), dimension(:), allocatable :: Items
22 end type TType
23 Type(TType) T
24
25 allocate(T%Items(2))
26 allocate(T%Items(2)%P)
27 T%Items(2)%P%Name = 'test'
28 if (T%Items(2)%P%Name .ne. 'test') stop 1
29
30 end subroutine gbug
31 end program tester