[Bug fortran/85737] gfortran 8.1.0 false positive with -Wdo-subscript

tkoenig at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 10 18:30:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85737

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |tkoenig at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
It is working as (currently) designed.

To quote from the description:

`-Wdo-subscript'
     Warn if an array subscript inside a DO loop could lead to an
     out-of-bounds access even if the compiler can not 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'.

Some more extensive data flow analysis may be possible in
future versions of gfortran.

It is always possible to turn this off via -Wno-do-subscript.


More information about the Gcc-bugs mailing list