File: bounds_check_24.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (28 lines) | stat: -rw-r--r-- 743 bytes parent folder | download
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
26
27
28
! { dg-do compile }
! { dg-additional-options "-fcheck=bounds -fdump-tree-original" }
!
! PR fortran/113471 - wrong array bounds check

program pr113471
  implicit none
  type t
     integer, dimension(2) :: c1 = 0
  end type t
  type(t) :: cc(7), bb(7)
  integer :: kk = 1

  ! no bounds check (can be determined at compile time):
  call foo (cc(7)% c1)

  ! bounds check involving kk, but no "outside of expected range"
  call foo (bb(kk)% c1)

contains
  subroutine foo (c)
    integer, intent(in) :: c(:)
  end
end

! { dg-final { scan-tree-dump-times "below lower bound" 2 "original" } }
! { dg-final { scan-tree-dump-times "above upper bound" 2 "original" } }
! { dg-final { scan-tree-dump-not "outside of expected range" "original" } }