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  <tkoenig@gcc.gnu.org>
6!
7module foo
8  implicit none
9contains
10  function bar()
11    integer bar
12    integer :: i=9
13    i = i + 1
14    bar = i
15  end function bar
16end module foo
17
18program 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') call abort
27  if (len (name) .ne. 10 ) call abort
28end program note7_35
29