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

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

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

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 9 and 10 issue the expected warning, likely as a result of r264822:

pr87719.c: In function ‘f’:
pr87719.c:5:26: warning: ‘%s’ directive argument is not a nul-terminated string
[-Wformat-overflow=]
    5 |   __builtin_sprintf (d, "%s", a);   // warning, good
      |                          ^~   ~
pr87719.c:1:12: note: referenced argument declared here
    1 | const char a[] = { 'a', 'b' };
      |            ^
pr87719.c: In function ‘g’:
pr87719.c:10:22: warning: ‘%s’ directive argument is not a nul-terminated
string [-Wformat-overflow=]
   10 |   __builtin_printf ("%s", a);   // missing warning
      |                      ^~   ~
pr87719.c:1:12: note: referenced argument declared here
    1 | const char a[] = { 'a', 'b' };
      |            ^

Reply via email to