From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12075 invoked by alias); 6 Oct 2015 20:03:26 -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 12032 invoked by uid 48); 6 Oct 2015 20:03:22 -0000 From: "dcb314 at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/67873] New: ice in duplicate_ssa_name_range_info Date: Tue, 06 Oct 2015 20:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dcb314 at hotmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-10/txt/msg00453.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D67873 Bug ID: 67873 Summary: ice in duplicate_ssa_name_range_info Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Target Milestone: --- Created attachment 36455 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D36455&action=3Dedit C source code $ ../results/bin/gcc -c -O3 bug235.c src/filer.c: In function =E2=80=98str_cut=E2=80=99: src/filer.c:980:16: warning: implicit declaration of function =E2=80=98wcsw= idth=E2=80=99 [-Wimplicit-function-declaration] src/filer.c: In function =E2=80=98str_cut2.constprop=E2=80=99: src/filer.c:1015:6: internal compiler error: in duplicate_ssa_name_range_in= fo, at tree-ssanames.c:506 0xd9de75 duplicate_ssa_name_range_info(tree_node*, value_range_type, range_info_def*) ../../src/trunk/gcc/tree-ssanames.c:506 0xd1a874 eliminate_dom_walker::before_dom_children(basic_block_def*) ../../src/trunk/gcc/tree-ssa-pre.c:4127 0x1256eb9 dom_walker::walk(basic_block_def*) ../../src/trunk/gcc/domwalk.c:177 >>From gcc-bugs-return-498899-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Oct 06 20:06:17 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 39519 invoked by alias); 6 Oct 2015 20:06:17 -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 Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 39492 invoked by uid 48); 6 Oct 2015 20:06:13 -0000 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/67872] missing -Warray-bounds warning, bogus -Wmaybe-uninitialized Date: Tue, 06 Oct 2015 20:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: 2015-10/txt/msg00454.txt.bz2 Content-length: 1305 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67872 --- Comment #1 from Martin Sebor --- Looking for existing code in place to issue -Warray-bounds warnings I came across fold_offsetof_1 in c-family/c-common.c. The function is designed to warn for out of bounds indices in offsetof expressions but doesn't detect the following: struct A { int a[3]; } a; int foo (void) { return __builtin_offsetof (struct A, a[4]); } This (otherwise untested) patch fixes it and makes the function diagnose this case. (The comment about flexible array members above the block suggests that the patch might need tweaking to avoid false positives for such constructs.) --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -10623,7 +10623,8 @@ fold_offsetof_1 (tree expr) man's flexible array member with a very permissive definition thereof. */ if (TREE_CODE (v) == ARRAY_REF - || TREE_CODE (v) == COMPONENT_REF) + || TREE_CODE (v) == COMPONENT_REF + || TREE_CODE (v) == INDIRECT_REF) warning (OPT_Warray_bounds, "index %E denotes an offset " "greater than size of %qT",