Debian Codegraph @

gcc/testsuite/gfortran.dg/array_constructor_36.f90

raw
1 ! { dg-do run }
2 ! Test the fix for PR47348, in which the substring length
3 ! in the array constructor at line 19 would be missed and
4 ! the length of q used instead.
5 !
6 ! Contributed by Thomas Koenig <[email protected]>
7 !
8 program main
9 implicit none
10 character(len = *), parameter :: fmt='(2(A,"|"))'
11 character(len = *), parameter :: test='xyc|aec|'
12 integer :: i
13 character(len = 4) :: q
14 character(len = 8) :: buffer
15 q = 'xy'
16 i = 2
17 write (buffer, fmt) (/ trim(q), 'ae' /)//'c'
18 if (buffer .ne. test) STOP 1
19 write (buffer, FMT) (/ q(1:i), 'ae' /)//'c'
20 if (buffer .ne. test) STOP 2
21 end program main