2018-10-08 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / associate_41.f90
blob9177582a5fcbce85f305b811d5fa000047bf2844
1 ! { dg-do run }
3 ! Test the fix for PR86372 in which the associate name string length was
4 ! not being set, thereby causing a segfault.
6 ! Contributed by Janus Weil <janus@gcc.gnu.org>
8 program xxx
10 character(len=50) :: s
12 s = repeat ('*', len(s))
13 call sub(s)
14 if (s .ne. '**'//'123'//repeat ('*', len(s) - 5)) stop 1
16 contains
18 subroutine sub(str)
19 character(len=*), intent(inout) :: str
20 associate (substr => str(3:5))
21 substr = '123'
22 end associate
23 end subroutine
25 end