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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |10.0
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot 
gnu.org
   Target Milestone|---                         |10.0
      Known to fail|                            |9.2.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 10.0 works as expected, likely as a result of r278623.

pr91535.c: In function ‘f0’:
pr91535.c:5:29: warning: offset ‘0’ outside bounds of constant string
[-Warray-bounds]
    5 |   return __builtin_strlen (s.a);
      |                            ~^~
pr91535.c:1:37: note: ‘s’ declared here
    1 | const struct S { int i; char a[]; } s = { 0 };
      |                                     ^
pr91535.c: In function ‘f3’:
pr91535.c:20:25: warning: offset ‘0’ outside bounds of constant string
[-Warray-bounds]
   20 |   __builtin_strcpy (d, s.a);
      |                        ~^~
pr91535.c:1:37: note: ‘s’ declared here
    1 | const struct S { int i; char a[]; } s = { 0 };
      |                                     ^
pr91535.c: In function ‘f4’:
pr91535.c:25:15: warning: offset ‘0’ outside bounds of constant string
[-Warray-bounds]
   25 |   return 0 != __builtin_strchr (s.a, 'x');   // missing warning
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
pr91535.c:1:37: note: ‘s’ declared here
    1 | const struct S { int i; char a[]; } s = { 0 };
      |                                     ^
pr91535.c: In function ‘f5’:
pr91535.c:30:15: warning: offset ‘0’ outside bounds of constant string
[-Warray-bounds]
   30 |   return 0 != __builtin_strrchr (s.a, 'x');   // missing warning
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
pr91535.c:1:37: note: ‘s’ declared here
    1 | const struct S { int i; char a[]; } s = { 0 };
      |                                     ^
pr91535.c: In function ‘f1’:
pr91535.c:10:29: warning: offset ‘0’ outside bounds of constant string
[-Warray-bounds]
   10 |   return __builtin_strcmp (s.a, "123");
      |                            ~^~
pr91535.c:1:37: note: ‘s’ declared here
    1 | const struct S { int i; char a[]; } s = { 0 };
      |                                     ^
pr91535.c: In function ‘f2’:
pr91535.c:15:36: warning: offset ‘0’ outside bounds of constant string
[-Warray-bounds]
   15 |   return __builtin_strcmp ("123", s.a);
      |                                   ~^~
pr91535.c:1:37: note: ‘s’ declared here
    1 | const struct S { int i; char a[]; } s = { 0 };
      |                                     ^

Reply via email to