From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24035 invoked by alias); 14 Nov 2013 17:56:54 -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 23963 invoked by uid 48); 14 Nov 2013 17:56:50 -0000 From: "d.g.gorbachev at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/59124] [4.8/4.9 Regression] Wrong warnings "array subscript is above array bounds" Date: Thu, 14 Nov 2013 17:56:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.8.3 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: d.g.gorbachev at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.3 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: 2013-11/txt/msg01401.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124 --- Comment #2 from Dmitry Gorbachev --- Another testcase: ============= 8< ============= extern char *bar[17]; int foo(int argc, char **argv) { int i; int n = 0; for (i = 0; i < argc; i++) n++; for (i = 0; i < argc; i++) argv[i] = bar[i + n]; return 0; } ============= >8 ============= $ gcc -S -Wall -O3 2.c 2.c: In function 'foo': 2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds] argv[i] = bar[i + n]; ^ 2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds] 2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds] 2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds] 2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds] 2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds] 2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds] 2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds] 2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds]