Debian Codegraph @

gcc/testsuite/gfortran.dg/array_reference_2.f90

raw
1 ! { dg-do run }
2 !
3 ! Test the fix for PR89200, in which the indexing did not work in
4 ! the write statement below.
5 !
6 ! Contributed by Damian Rouson <[email protected]>
7 !
8 type foo
9 character(len=:), allocatable :: string
10 end type
11 type foo_list
12 type(foo), allocatable :: entry(:)
13 end type
14 type(foo_list) list
15 character(4) :: buffer
16 list = foo_list([foo('12'), foo('34')])
17 write(buffer, '(2a2)') list%entry(1)%string, list%entry(2)%string
18 if (buffer .ne. '1234') stop 1
19 deallocate (list%entry)
20 end