PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / allocate_with_source_2.f90
blob16732e23f1cf08fdde4487478de37153da80a821
1 ! { dg-do run }
2 ! PR 45170
3 ! A variation of a theme for deferred type parameters. The
4 ! substring reference in the source= portion of the allocate
5 ! was not probably resolved. Testcase is a modified version
6 ! of a program due to Hans-Werner Boschmann <boschmann at tp1
7 ! dot physik dot uni-siegen dot de>
9 program helloworld
10 character(:),allocatable::string
11 real::rnd
12 call hello(5, string)
13 if (string /= 'hello' .or. len(string) /= 5) STOP 1
14 contains
15 subroutine hello (n,string)
16 character(:),allocatable,intent(out)::string
17 integer,intent(in)::n
18 character(20)::helloworld="hello world"
19 allocate(string, source=helloworld(:n))
20 end subroutine hello
21 end program helloworld