[Bug tree-optimization/89688] [9 Regression] -Wstringop-overflow confused by const 2D array of char

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 12 19:35:00 GMT 2019


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic,
                   |                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-03-12
                 CC|                            |msebor at gcc dot gnu.org
          Component|c++                         |tree-optimization
            Summary|-Wstringop-overflow         |[9 Regression]
                   |confused by 2D array of     |-Wstringop-overflow
                   |char                        |confused by const 2D array
                   |                            |of char
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  string_constant successfully folds the call but also sets *DECL to
point to the array which fold_builtin_strlen interprets as the array not being
nul-terminated.  This in turn disables the folding and results in the false
positive.  Fixing it should be as simple as clearing *DECL.

The false positive is a regression.  The strlen() call wasn't folded before so
it by itself isn't, but they might both as well be fixed together.


More information about the Gcc-bugs mailing list