blob: d386bb33b7c99f02c6570c31d03c46e766e95f42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
! { dg-do run }
! Test the fix for PR47592, in which the SOURCE expression was
! being called twice.
!
! Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
!
module foo
implicit none
contains
function bar()
integer bar
integer :: i=9
i = i + 1
bar = i
end function bar
end module foo
program note7_35
use foo
implicit none
character(:), allocatable :: name
character(:), allocatable :: src
integer n
n = 10
allocate(name, SOURCE=repeat('x',bar()))
if (name .ne. 'xxxxxxxxxx') call abort
if (len (name) .ne. 10 ) call abort
end program note7_35
! { dg-final { cleanup-modules "foo" } }
|