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 bootstrap/101374] [12 Regression] bootstrap failure varpool.c:490:19: error: array subscript 'varpool_node[0]' is partly outside array bounds of 'varpool_node [0]' [-Werror=array-bounds] Date: Thu, 08 Jul 2021 15:47:50 +0000 [thread overview] Message-ID: <bug-101374-4-sg14a3rBYV@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101374-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101374 --- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> --- For the test case the warning sees this: int varpool_node::_ZN12varpool_node16get_availabilityEv.part.0 (struct varpool_node * const this) { ... struct symtab_node * _7; struct varpool_node * _12; ... <bb 2> [local count: 1073741824]: _7 = &this_1(D)->D.2395; <<< varpool_node::symtab_node subobject _11 = is_a<varpool_node*, symtab_node*> (_7); if (_11 != 0) goto <bb 4>; [71.00%] else goto <bb 3>; [29.00%] <bb 3> [local count: 311385128]: <bb 4> [local count: 1073741824]: # _12 = PHI <_7(2), 0B(3)> <<< _12 size is (at most) 4 _15 = BIT_FIELD_REF <*_12, 8, 0>; <<< -Warray-bounds The MEM_REF *_12 accesses a varpool_node object with size 8 but _12 points to a symtab_node subobject with size of just 4. So the warning code works correctly. It triggers because the call to compute_objsize(..., 1, ...) (with Object Size Type 1) respects subobject boundaries and so doesn't consider that _12, or more precisely _7, points to a subobject of a larger object. Before r12-2132 -Warray-bounds did its own slightly more conservative computation which was roughly equivalent to Object Size Type 0. Calling compute_objsize(..., 0, ...) instead avoids the warning for the reduced test case. Let me see if it also fixes the rest of the problems.
next prev parent reply other threads:[~2021-07-08 15:47 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-08 7:43 [Bug bootstrap/101374] New: " rguenth at gcc dot gnu.org 2021-07-08 7:44 ` [Bug bootstrap/101374] " rguenth at gcc dot gnu.org 2021-07-08 7:48 ` rguenth at gcc dot gnu.org 2021-07-08 8:50 ` rguenth at gcc dot gnu.org 2021-07-08 9:22 ` rguenth at gcc dot gnu.org 2021-07-08 9:26 ` rguenth at gcc dot gnu.org 2021-07-08 10:46 ` schwab@linux-m68k.org 2021-07-08 14:47 ` schwab@linux-m68k.org 2021-07-08 14:47 ` schwab@linux-m68k.org 2021-07-08 14:49 ` msebor at gcc dot gnu.org 2021-07-08 15:47 ` msebor at gcc dot gnu.org [this message] 2021-07-08 17:44 ` cvs-commit at gcc dot gnu.org 2021-07-08 18:04 ` msebor at gcc dot gnu.org 2021-07-08 21:20 ` bergner at gcc dot gnu.org 2021-07-08 22:13 ` msebor at gcc dot gnu.org 2021-07-10 2:49 ` cvs-commit at gcc dot gnu.org 2021-07-13 16:10 ` msebor at gcc dot gnu.org 2021-07-16 16:33 ` abidh at gcc dot gnu.org
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-101374-4-sg14a3rBYV@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).