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 middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset
Date: Sun, 29 Nov 2020 22:38:52 +0000	[thread overview]
Message-ID: <bug-89428-4-PTqJua8iVA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-89428-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |11.0

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
Resolved by  r11-5523 for GCC 11 which now issues the following warnings for
the test case in comment #0 (the duplicate note needs to be fixed):

$ gcc -O2 -S pr89428.c
pr89428.c: In function ‘f’:
pr89428.c:7:3: warning: ‘__builtin_memset’ writing 7 bytes into a region of
size 6 overflows the destination [-Wstringop-overflow=]
    7 |   __builtin_memset (a + i, 0, 7);   // warning (good)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pr89428.c:1:6: note: at offset [1, 2] into destination object ‘a’ of size 7
    1 | char a[7];
      |      ^
pr89428.c: In function ‘g’:
pr89428.c:14:3: warning: ‘__builtin_memset’ writing 99 bytes into a region of
size 7 overflows the destination [-Wstringop-overflow=]
   14 |   __builtin_memset (a + i, 0, 99);   // missing warning (bug)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pr89428.c:1:6: note: destination object ‘a’ of size 7
    1 | char a[7];
      |      ^
pr89428.c:1:6: note: destination object ‘a’ of size 7

      parent reply	other threads:[~2020-11-29 22:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-89428-4@http.gcc.gnu.org/bugzilla/>
2020-04-22 21:55 ` msebor at gcc dot gnu.org
2020-04-26  8:01 ` xerofoify at gmail dot com
2020-10-29 19:27 ` msebor at gcc dot gnu.org
2020-11-03 15:32 ` msebor at gcc dot gnu.org
2020-11-29 22:13 ` cvs-commit at gcc dot gnu.org
2020-11-29 22:38 ` msebor at gcc dot gnu.org [this message]

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-89428-4-PTqJua8iVA@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).