Debian Codegraph @

gcc/testsuite/gfortran.dg/bounds_check_24.f90

raw
1 ! { dg-do compile }
2 ! { dg-additional-options "-fcheck=bounds -fdump-tree-original" }
3 !
4 ! PR fortran/113471 - wrong array bounds check
5
6 program pr113471
7 implicit none
8 type t
9 integer, dimension(2) :: c1 = 0
10 end type t
11 type(t) :: cc(7), bb(7)
12 integer :: kk = 1
13
14 ! no bounds check (can be determined at compile time):
15 call foo (cc(7)% c1)
16
17 ! bounds check involving kk, but no "outside of expected range"
18 call foo (bb(kk)% c1)
19
20 contains
21 subroutine foo (c)
22 integer, intent(in) :: c(:)
23 end
24 end
25
26 ! { dg-final { scan-tree-dump-times "below lower bound" 2 "original" } }
27 ! { dg-final { scan-tree-dump-times "above upper bound" 2 "original" } }
28 ! { dg-final { scan-tree-dump-not "outside of expected range" "original" } }