Debian Codegraph @

gcc/testsuite/gfortran.dg/bounds_check_fail_6.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-fcheck=bounds -g -fdump-tree-original" }
3 ! { dg-output "At line 18 .*" }
4 ! { dg-shouldfail "dimension 3 of array 'u%z' outside of expected range" }
5 !
6 ! PR fortran/30802 - improve bounds-checking for array sections
7
8 program test
9 implicit none
10 integer :: k = 0
11 integer, dimension(10,20,30) :: x = 42
12 type t
13 real, dimension(10,20,30) :: z = 23
14 end type t
15 type(t) :: u
16
17 ! pr30802
18 print *, u% z(1,:,k) ! runtime check only for dimension 3
19
20 ! pr97039
21 call foo (x(k,:,k+1)) ! runtime checks for dimensions 1,3
22 contains
23 subroutine foo (a)
24 integer, intent(in) :: a(:)
25 end subroutine foo
26 end program test
27
28 ! { dg-final { scan-tree-dump-times "'u%%z.' outside of expected range" 2 "original" } }
29 ! { dg-final { scan-tree-dump-times "'x.' outside of expected range" 4 "original" } }