Debian Codegraph @

gcc/testsuite/gfortran.dg/bounds_check_23.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-fcheck=bounds -fdump-tree-original" }
3 ! PR fortran/98490 - out of bounds in array constructor with implied do loop
4
5 program test
6 implicit none
7 call sub('Lorem ipsum')
8 call sub2('Lorem ipsum')
9 call sub3('Lorem ipsum')
10 contains
11 subroutine sub( text )
12 character(len=*), intent(in) :: text
13 character(len=1), allocatable :: c(:)
14 integer :: i
15 c = [ ( text(i:i), i = 1, len(text) ) ]
16 if (c(1) /= 'L') stop 1
17 end subroutine sub
18 subroutine sub2 (txt2)
19 character(len=*), intent(in) :: txt2
20 character(len=1), allocatable :: c(:)
21 integer :: i
22 c = [ ( txt2(i+0:i), i = 1, len(txt2) ) ]
23 if (c(1) /= 'L') stop 2
24 end subroutine sub2
25 subroutine sub3 (txt3)
26 character(len=*), intent(in) :: txt3
27 character(len=1), allocatable :: c(:)
28 integer :: i
29 c = [ ( txt3(i:i+0), i = 1, len(txt3) ) ]
30 if (c(1) /= 'L') stop 3
31 end subroutine sub3
32 end program test
33
34 ! { dg-final { scan-tree-dump-times "Substring out of bounds:" 6 "original" } }