Debian Codegraph @

gcc/testsuite/gfortran.dg/allocate_with_source_1.f90

raw
1 ! { dg-do run }
2 ! Test the fix for PR47592, in which the SOURCE expression was
3 ! being called twice.
4 !
5 ! Contributed by Thomas Koenig <[email protected]>
6 !
7 module foo
8 implicit none
9 contains
10 function bar()
11 integer bar
12 integer :: i=9
13 i = i + 1
14 bar = i
15 end function bar
16 end module foo
17
18 program note7_35
19 use foo
20 implicit none
21 character(:), allocatable :: name
22 character(:), allocatable :: src
23 integer n
24 n = 10
25 allocate(name, SOURCE=repeat('x',bar()))
26 if (name .ne. 'xxxxxxxxxx') STOP 1
27 if (len (name) .ne. 10 ) STOP 2
28 end program note7_35