https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90237
--- Comment #2 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Wed, Apr 24, 2019 at 10:01:13PM +0000, tkoenig at gcc dot gnu.org wrote: > --- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- > We should probably rename the option. It works as advertised: A renaming is probably not needed. A better description including a clearer statement about false-positives may be helpful. > `-Wdo-subscript' > Warn if an array subscript inside a DO loop could lead to an > out-of-bounds access even if the compiler cannot prove that the > statement is actually executed, in cases like > real a(3) > do i=1,4 > if (condition(i)) then > a(i) = 1.2 > end if > end do > This option is implied by `-Wextra'. > > > but people keep stumbling over it. > `-Wdo-subscript' Warn if an array subscript inside a DO loop could lead to an out-of-bounds access. This warning currently does not consider conditional statement that may prevent an out-of-bounds access. For example, a false-positive will be emitted for real a(3) do i=1,4 if (i > 1) then a(i-1) = 1.2 end if end do This option is implied by `-Wextra'. See also the -fcheck=bounds option.