public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/43270] array-bounds false negative Date: Sat, 06 Mar 2010 14:28:00 -0000 [thread overview] Message-ID: <20100306142749.28014.qmail@sourceware.org> (raw) In-Reply-To: <bug-43270-8137@http.gcc.gnu.org/bugzilla/> ------- Comment #13 from rguenth at gcc dot gnu dot org 2010-03-06 14:27 ------- Err - it's just because the code is broken: tree low_bound, up_bound = array_ref_up_bound (ref); low_sub = up_sub = TREE_OPERAND (ref, 1); if (!up_bound || TREE_NO_WARNING (ref) || TREE_CODE (up_bound) != INTEGER_CST /* Can not check flexible arrays. */ || (TYPE_SIZE (TREE_TYPE (ref)) == NULL_TREE && TYPE_DOMAIN (TREE_TYPE (ref)) != NULL_TREE && TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (ref))) == NULL_TREE) well - this checks TYPE_SIZE/DOMAIN on the element type ... and the struct hack check is too strict: /* Accesses after the end of arrays of size 0 (gcc extension) and 1 are likely intentional ("struct hack"). */ || compare_tree_int (up_bound, 1) <= 0) Replacing that with a more proper (but still too strict) check like /* Accesses after the end of arrays at the end of structures are likely intentional ("struct hack"). */ if (TREE_CODE (TREE_OPERAND (ref, 0)) == COMPONENT_REF && !TREE_CHAIN (TREE_OPERAND (TREE_OPERAND (ref, 0), 1))) return; gets you t.C: In function 'int main()': t.C:27:45: warning: array subscript is above array bounds it doesn't print that this is from an inlined constructor though. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Severity|normal |enhancement Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2010-03-06 14:27:49 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43270
next prev parent reply other threads:[~2010-03-06 14:28 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-03-05 20:20 [Bug tree-optimization/43270] New: " matt at use dot net 2010-03-05 20:22 ` [Bug tree-optimization/43270] " matt at use dot net 2010-03-05 20:33 ` matt at use dot net 2010-03-05 20:35 ` pinskia at gcc dot gnu dot org 2010-03-05 22:17 ` matt at use dot net 2010-03-05 22:22 ` pinskia at gcc dot gnu dot org 2010-03-05 23:25 ` matt at use dot net 2010-03-05 23:25 ` matt at use dot net 2010-03-05 23:26 ` pinskia at gcc dot gnu dot org 2010-03-06 0:19 ` matt at use dot net 2010-03-06 0:20 ` matt at use dot net 2010-03-06 0:23 ` pinskia at gcc dot gnu dot org 2010-03-06 1:31 ` matt at use dot net 2010-03-06 14:28 ` rguenth at gcc dot gnu dot org 2010-03-06 14:28 ` rguenth at gcc dot gnu dot org [this message] 2010-04-07 12:31 ` rguenth at gcc dot gnu dot org 2010-04-07 12:34 ` rguenth at gcc dot gnu dot org 2010-07-05 0:11 ` pinskia at gcc dot gnu dot org 2010-07-07 10:08 ` rguenth at gcc dot gnu dot org [not found] <bug-43270-4@http.gcc.gnu.org/bugzilla/> 2011-03-26 16:15 ` aj664 at hotmail dot com 2011-03-26 17:34 ` aj664 at hotmail dot com 2011-04-12 18:13 ` matt at use dot net
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=20100306142749.28014.qmail@sourceware.org \ --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).