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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|duplicate warning offset    |triplicate warning offset
                   |outside bounds of constant  |outside bounds of constant
                   |string                      |string

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
An even better example of the same problem.  It also illustrates how the
warning location gets progressively worse:

$ cat a.c && gcc -S -Wall a.c 
const char s[0] = { };

int f (void)
{
  return __builtin_strlen (s);
}
a.c: In function ‘f’:
a.c:5:28: warning: offset ‘0’ outside bounds of constant string
[-Warray-bounds]
    5 |   return __builtin_strlen (s);
      |                            ^
a.c:1:12: note: ‘s’ declared here
    1 | const char s[0] = { };
      |            ^
a.c:5:10: warning: offset ‘0’ outside bounds of constant string
[-Warray-bounds]
    5 |   return __builtin_strlen (s);
      |          ^~~~~~~~~~~~~~~~~~~~
a.c:1:12: note: ‘s’ declared here
    1 | const char s[0] = { };
      |            ^
a.c:3:5: warning: offset ‘0’ outside bounds of constant string [-Warray-bounds]
    3 | int f (void)
      |     ^
a.c:1:12: note: ‘s’ declared here
    1 | const char s[0] = { };
      |            ^

Reply via email to