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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |false-positive

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the location is messed up starting in GCC 12.

GCC 11 gave:
<source>: In function 'int g()':
<source>:13:27: warning: offset '1' outside bounds of constant string
[-Warray-bounds]
   13 |   return __builtin_strlen (p - sizeof s.a);    // bogus -Warray-bounds
      |          ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

GCC 12 gives:
<source>: In function 'int g()':
<source>:10:5: warning: offset '1' outside bounds of constant string
[-Warray-bounds]
   10 | int g (void)
      |     ^


Looks like c_strlen could use a loc argument but that is a huge huge change.

Reply via email to