Debian Codegraph @

gcc/testsuite/gfortran.dg/associate_41.f90

raw
1 ! { dg-do run }
2 !
3 ! Test the fix for PR86372 in which the associate name string length was
4 ! not being set, thereby causing a segfault.
5 !
6 ! Contributed by Janus Weil <[email protected]>
7 !
8 program xxx
9
10 character(len=50) :: s
11
12 s = repeat ('*', len(s))
13 call sub(s)
14 if (s .ne. '**'//'123'//repeat ('*', len(s) - 5)) stop 1
15
16 contains
17
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
24
25 end