0069092f6b8b3ac9aa942c0acff567cc3336e2db
[platform/upstream/gcc48.git] / gcc / testsuite / gfortran.dg / allocate_with_source_1.f90
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 !
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') call abort
27   if (len (name) .ne. 10 ) call abort
28 end program note7_35