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/103292] [12 regression] xorg-server-1.20.13 -Werror=array-bounds false positive on unions Date: Wed, 17 Nov 2021 22:34:12 +0000 [thread overview] Message-ID: <bug-103292-4-YnS2Jl99bW@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103292-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103292 Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |DUPLICATE Component|c |middle-end Blocks| |56456 CC| |jeffreyalaw at gmail dot com --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- The originally intended purpose of this instance of -Warray-bounds was to warn for accesses to smaller buffers by larger lvalues, like in this function: struct A { int i; }; struct B { long j; }; struct B* make_B_from_A (const struct A *p) { struct B *q = __builtin_malloc (sizeof *p); // should be sizeof *q q->j = p->i; return q; } Here a warning should be issued regardless of whether -fstrict-aliasing is in effect because the access is out of bounds. That the warning also triggers in instances when the problem isn't one of an out-of-bounds access but rather an aliasing violation was incidental (i.e., I didn't set out with that as a goal), but because -Wstrict-aliasing in GCC is very limited, seemed like a bonus. So an argument could be (and in pr98503 in fact was) made that the instances of -Warray-bounds where the ultimate access is strictly in bounds should be replaced by one of -Wstrict-aliasing, which is enabled only when -fstrict-aliasing is in effect. I agreed and submitted a patch to do that: https://gcc.gnu.org/pipermail/gcc-patches/2021-January/564483.html Regrettably, the change was rejected. I CC the reviewer for his comments. *** This bug has been marked as a duplicate of bug 98503 *** Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456 [Bug 56456] [meta-bug] bogus/missing -Warray-bounds
prev parent reply other threads:[~2021-11-17 22:34 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-16 22:47 [Bug c/103292] New: " slyfox at gcc dot gnu.org 2021-11-17 1:32 ` [Bug c/103292] " msebor at gcc dot gnu.org 2021-11-17 21:49 ` slyfox at gcc dot gnu.org 2021-11-17 22:34 ` 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-103292-4-YnS2Jl99bW@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: linkBe 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).