------- Comment #7 from mikael at gcc dot gnu dot org 2009-01-05 15:08 -------
(In reply to comment #6)
> If compiled with -fbounds-check, the executable yields:
>
> At line 29 of file
> /opt/gcc/_gcc_clean/gcc/testsuite/gfortran.dg/elemental_subroutine_7.f90
> Fortran runtime error: Array reference out of bounds for array 'p', lower
> bound
> of dimension 1 exceeded(-2 < 1)
>
> The problem comes from
>
> ...
> p = 20 * r - 10
> ...
> call tq_tvgh (q(k_lev:), (p(p(k_lev:))))
> if (any (p(p) /= q)) call abort
>
> where min(p)=-10, outside the bounds of p(1:42).
>
> If I use ' p = 41 * r + 1', the test passes.
>
Yes, of course. Stupid me.
I started with the random thing, and I added the vector subscript later.
Thanks Dominique.
--
mikael at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.3 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38726