Debian Codegraph @

gcc/testsuite/gfortran.dg/zero_sized_13.f90

raw
1 ! { dg-do compile }
2 ! { dg-options "-w" }
3 !
4 ! PR fortran/95374
5 ! PR fortran/104352 - Various ICEs for bounds violation with zero-sized arrays
6 !
7 ! Contributed by G. Steinmetz
8
9 program p
10 implicit none
11 integer :: i
12 integer, parameter :: a(0) = 0
13 integer, parameter :: b(0:-5) = 0
14 integer, parameter :: c(*) = [(a(i:i), i=0,0)] ! { dg-error "out of bounds" }
15 integer, parameter :: d(*) = [(b(i:i), i=1,1)] ! { dg-error "out of bounds" }
16 integer, parameter :: e(1) = [(a(i) , i=1,1)] ! { dg-error "out of bounds" }
17 integer, parameter :: f(1) = [(a(i:i), i=1,1)] ! { dg-error "out of bounds" }
18 integer :: g(1) = [(a(i:i), i=0,0)] ! { dg-error "out of bounds" }
19 integer :: h(1) = [(a(i:i), i=1,1)] ! { dg-error "out of bounds" }
20 print *, [(a(i:i), i=0,0)] ! { dg-error "out of bounds" }
21 print *, [(a(i:i), i=1,1)] ! { dg-error "out of bounds" }
22 print *, any (a(1:1) == 1) ! { dg-error "out of bounds" }
23 print *, all (a(0:0) == 1) ! { dg-error "out of bounds" }
24 print *, sum (a(1:1)) ! { dg-error "out of bounds" }
25 print *, iall (a(0:0)) ! { dg-error "out of bounds" }
26 print *, minloc (a(0:0),1) ! { dg-error "out of bounds" }
27 print *, dot_product(a(1:1),a(1:1)) ! { dg-error "out of bounds" }
28 end