http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58146

--- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #4)
> (In reply to Thomas Koenig from comment #0)
> > neither does it do so with -fcheck=all at runtime:
> > 
> There is no out of bound at run time because the scalarizer sets the loop
> bounds according to the array providing the most information; in this case
> the constant array of size 3, so that the loop has only 3 iterations.

This variant should trigger an out of bound runtime error, but it doesn't
either.

program main
  implicit none
  integer :: n
  real, dimension(4) :: a
  n = 0
  call random_number(a)
  if (any(a(n+1:n+4) > [1.0, 2.0, 3.0, 4.0, 5.0])) print *,"Hello!"
end program main


Technically a(n+1:n+4) is within the bounds, the out of bounds comes from the
loop with a 5-sized array.

Reply via email to