[Bug fortran/90237] Bogus warning from -Wdo-subscript
sgk at troutmask dot apl.washington.edu
gcc-bugzilla@gcc.gnu.org
Tue May 21 21:54:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90237
--- Comment #7 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, May 21, 2019 at 09:43:29PM +0000, dominiq at lps dot ens.fr wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90237
>
> --- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> > Why does this *warning* actually cause an error and abort the compilation?
> > This is what I consider the bug, not the fact that it can't catch
> > all cases properly.
>
> A warning is not an error unless you use -Werror or in some cases -pedantic.
>
Re-read Tobias's PR then.
% gfcx -Wdo-subscript a.f90
a.f90:11:28:
11 | p(j) = p(swap(j))
| 1
Error: Index in dimension 1 is out of bounds at (1)
a.f90:11:28:
9 | do j=1,6
| 2
10 | if (j<5) then
11 | p(j) = p(swap(j))
| 1
Warning: Array reference at (1) out of bounds (6 > 4) in loop beginning at (2)
-Wdo-subscript]
Why is there an error?
More information about the Gcc-bugs
mailing list