From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22489 invoked by alias); 9 Feb 2014 00:47:36 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 22452 invoked by uid 48); 9 Feb 2014 00:47:32 -0000 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/60121] gcc does not warn an obvious out-of-bound array access at -O0 and -O1 Date: Sun, 09 Feb 2014 00:47:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg00865.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60121 --- Comment #7 from Andrew Pinski --- (In reply to Chengnian Sun from comment #6) > The test case can be further reduced to the following code, which is NOT > dead or dependent on bug 60115. > > int b[1]; > int f() { > return b[9999]; > } Because we don't warn in the front-end. That was on purpose. I can find the old bug reports of why we don't want to warn in the front-end. The warning only happens in VPR which is only enabled for -O2 and above (-Os is -O2 plus optimize for size really).