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 middle-end/37861] New: Bogus array bounds warning Date: Fri, 17 Oct 2008 08:27:00 -0000 [thread overview] Message-ID: <bug-37861-10053@http.gcc.gnu.org/bugzilla/> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1609 bytes --] extern int printf (__const char *__restrict __format, ...); static int f2(char formatstr[10][100]) { int anz; for( anz = 0; anz < 10; ++anz ) { printf( "%d %s\n", anz, formatstr[anz] ); } return anz; } static char formatstr[10][100]; int main( void ) { int anz; anz = f2(formatstr); printf( " %d\n",anz); return 0; } with -O3 -Wall this reports t.c: In function main: t.c:6: warning: array subscript is above array bounds t.c:6: warning: array subscript is above array bounds t.c:6: warning: array subscript is above array bounds t.c:6: warning: array subscript is above array bounds t.c:6: warning: array subscript is above array bounds t.c:6: warning: array subscript is above array bounds t.c:6: warning: array subscript is above array bounds t.c:6: warning: array subscript is above array bounds because we end up with <bb 3>: # anz_23 = PHI <anz_6(4), anz_22(6)> D.1572_5 = (long unsigned int) anz_23; D.1573_7 = D.1572_5 * 100; D.1574_8 = &formatstr[0][D.1573_7]; printf (&"%d %s\n"[0], anz_23, D.1574_8); anz_9 = anz_23 + 1; <bb 4>: # anz_6 = PHI <anz_9(3)> if (anz_6 <= 9) goto <bb 3>; else goto <bb 5>; -- Summary: Bogus array bounds warning Product: gcc Version: 4.3.2 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37861
next reply other threads:[~2008-10-17 8:27 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-10-17 8:27 rguenth at gcc dot gnu dot org [this message] 2008-10-30 17:46 ` [Bug middle-end/37861] " jamborm at gcc dot gnu dot org 2008-10-30 18:45 ` manu at gcc dot gnu dot org 2008-10-31 17:54 ` jamborm at gcc dot gnu dot org 2008-10-31 18:02 ` jamborm at gcc dot gnu dot org 2008-11-04 15:52 ` jamborm at gcc dot gnu dot org 2008-11-05 9:56 ` [Bug middle-end/37861] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org 2008-11-05 16:09 ` jamborm at gcc dot gnu dot org 2008-11-05 20:51 ` [Bug middle-end/37861] [4.3 " jakub at gcc dot gnu dot org 2008-11-10 10:07 ` jamborm at gcc dot gnu dot org 2008-11-10 18:41 ` jamborm at gcc dot gnu dot org 2008-11-15 0:01 ` pinskia at gcc dot gnu dot org 2008-11-30 23:02 ` rguenth at gcc dot gnu dot org 2008-12-02 14:34 ` jamborm at gcc dot gnu dot org 2009-01-24 10:26 ` rguenth at gcc dot gnu dot org 2009-02-28 0:31 ` jamborm at gcc dot gnu dot org 2009-02-28 18:33 ` jamborm at gcc dot gnu dot org 2009-02-28 22:46 ` jamborm 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-37861-10053@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).