public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/87719] missing warning on printf %s and unterminated array
Date: Fri, 01 May 2020 18:05:31 +0000	[thread overview]
Message-ID: <bug-87719-4-5vebAFDMdl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-87719-4@http.gcc.gnu.org/bugzilla/>

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	other threads:[~2020-05-01 18:05 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <bug-87719-4@http.gcc.gnu.org/bugzilla/>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-87719-4-5vebAFDMdl@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).