PR ipa/83051
[official-gcc.git] / gcc / testsuite / gfortran.dg / assumed_charlen_sharing.f90
blob0c1c38a87e269faef2d387f66fc72c2d6f2c1931
1 ! This testcase was miscompiled, because ts.cl
2 ! in function bar was initially shared between both
3 ! dummy arguments. Although it was later unshared,
4 ! all expressions which copied ts.cl from bar2
5 ! before that used incorrectly bar1's length
6 ! instead of bar2.
7 ! { dg-do run }
9 subroutine foo (foo1, foo2)
10 implicit none
11 integer, intent(in) :: foo2
12 character(*), intent(in) :: foo1(foo2)
13 end subroutine foo
15 subroutine bar (bar1, bar2)
16 implicit none
17 character(*), intent(in) :: bar1, bar2
19 call foo ((/ bar2 /), 1)
20 end subroutine bar
22 program test
23 character(80) :: str1
24 character(5) :: str2
26 str1 = 'String'
27 str2 = 'Strng'
28 call bar (str2, str1)
29 end program test