aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/associate_41.f90
blob: 9177582a5fcbce85f305b811d5fa000047bf2844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
! { dg-do run }
!
! Test the fix for PR86372 in which the associate name string length was
! not being set, thereby causing a segfault.
!
! Contributed by Janus Weil  <janus@gcc.gnu.org>
!
program xxx

   character(len=50) :: s

   s = repeat ('*', len(s))
   call sub(s)
   if (s .ne. '**'//'123'//repeat ('*', len(s) - 5)) stop 1

contains

   subroutine sub(str)
      character(len=*), intent(inout) :: str
      associate (substr => str(3:5))
         substr = '123'
      end associate
   end subroutine

end