public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/40946] New: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning Date: Mon, 03 Aug 2009 08:27:00 -0000 [thread overview] Message-ID: <bug-40946-87@http.gcc.gnu.org/bugzilla/> (raw) /* { dg-do compile } */ /* { dg-options "-O2 -Wall" } */ struct A { unsigned char a1[8]; unsigned short a2, a3, a4, a5, a6, a7; }; int bar (void *, const char *, int); char *foo (void *, int); char * baz (const char *x, const char *y) { int a = sizeof (struct A) + 2 * (__builtin_strlen (y) + __builtin_strlen (x) + 24) + 16; struct A *b = __builtin_malloc (a); char *c; int d; b->a4 = sizeof (struct A); c = ((char *) b) + b->a4; d = ((char *) b) + a - c; b->a2 = b->a3 = (unsigned short) bar (c, y, d);/* { dg-bogus "array subscript is above array bounds" } */ c += b->a2; d = ((char *) b) + a - c; b->a7 = b->a4 + b->a2; b->a5 = b->a6 = (unsigned short) bar (c, x, d); c = foo (b, a); return c; } gives a spurious warning, because the cast of the struct to char pointer is folded into array ref on the first field. -- Summary: [4.3/4.4/4.5 Regression] Spurious array subscript is above bounds warning Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org GCC target triplet: powerpc-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40946
next reply other threads:[~2009-08-03 8:27 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-08-03 8:27 jakub at gcc dot gnu dot org [this message] 2009-08-08 22:58 ` [Bug middle-end/40946] " steven at gcc dot gnu dot org 2009-08-16 21:41 ` rguenth at gcc dot gnu dot org 2009-08-16 21:42 ` rguenth at gcc dot gnu dot org 2009-11-09 15:48 ` jakub at gcc dot gnu dot org 2009-11-09 15:51 ` rguenther at suse dot de 2009-11-09 19:39 ` jakub at gcc dot gnu dot org 2009-11-09 19:41 ` jakub at gcc dot gnu dot org 2009-11-09 19:44 ` [Bug middle-end/40946] [4.3 " jakub at gcc dot gnu dot org 2010-05-22 18:33 ` rguenth at gcc dot gnu dot 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-40946-87@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).