PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / allocate_deferred_char_scalar_2.f03
blob1f0f433010516739a58ceacca9bc146a22274dc8
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. 
5 ! Contributed by Tobias Burnus  <burnus@gcc.gnu.org>
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') call abort
15    if (len (name) .ne. 10 ) call abort
16    deallocate(name)
17    src = 'xyxy'
18    allocate(name, SOURCE=repeat(src,n))
19    if (name(37:40) .ne. 'xyxy') call abort
20    if (len (name) .ne. 40 ) call abort
21 end program note7_35