Debian Codegraph @

gcc/testsuite/gfortran.dg/allocate_deferred_char_scalar_2.f03

raw
1 ! { dg-do run }
2 ! Test the fix for PR47519, in which the character length was not
3 ! calculated for the SOURCE expressions below and an ICE resulted.
4 !
5 ! Contributed by Tobias Burnus <[email protected]>
6 !
7 program note7_35
8 implicit none
9 character(:), allocatable :: name
10 character(:), allocatable :: src
11 integer n
12 n = 10
13 allocate(name, SOURCE=repeat('x',n))
14 if (name .ne. 'xxxxxxxxxx') STOP 1
15 if (len (name) .ne. 10 ) STOP 2
16 deallocate(name)
17 src = 'xyxy'
18 allocate(name, SOURCE=repeat(src,n))
19 if (name(37:40) .ne. 'xyxy') STOP 3
20 if (len (name) .ne. 40 ) STOP 4
21 end program note7_35