From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CDC873858421; Tue, 28 Sep 2021 16:59:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDC873858421 From: "jlegg at feralinteractive dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/102518] New: [11/12 regression] ICE during GIMPLE pass: einline in gimplify_modify_expr at -O2 Date: Tue, 28 Sep 2021 16:59:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jlegg at feralinteractive 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 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-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 16:59:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102518 Bug ID: 102518 Summary: [11/12 regression] ICE during GIMPLE pass: einline in gimplify_modify_expr at -O2 Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: jlegg at feralinteractive dot com Target Milestone: --- Compiling this c++ code with g++ -O2 -c: struct A { bool operator<(A b) { return b.x; } int x; } * a; int f(int *const c) { const A & b =3D reinterpret_cast(c); while (a) if (*a < b) return 0; } int i; void g() { f(&i); } causes an ICE with g++ 11.2.0: v.ii:10:1: warning: control reaches end of non-void function [-Wreturn-type] 10 | } | ^ during GIMPLE pass: einline v.ii: In function 'void g()': v.ii:6:45: internal compiler error: in gimplify_modify_expr, at gimplify.c:= 5988 6 | const A & b =3D reinterpret_cast(c); | ^ 0x6772ed gimplify_modify_expr ../../gcc-11.2.0/gcc/gimplify.c:5988 0xac86de gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ../../gcc-11.2.0/gcc/gimplify.c:14094 0xacd4c2 gimplify_stmt(tree_node**, gimple**) ../../gcc-11.2.0/gcc/gimplify.c:6877 0xacd4c2 gimplify_and_add(tree_node*, gimple**) ../../gcc-11.2.0/gcc/gimplify.c:489 0xacd4c2 internal_get_tmp_var ../../gcc-11.2.0/gcc/gimplify.c:642 0xacd751 get_initialized_tmp_var(tree_node*, gimple**, gimple**, bool) ../../gcc-11.2.0/gcc/gimplify.c:674 0xacd751 prepare_gimple_addressable ../../gcc-11.2.0/gcc/gimplify.c:4334 0xacd7f1 gimplify_addr_expr ../../gcc-11.2.0/gcc/gimplify.c:6230 0xac924f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ../../gcc-11.2.0/gcc/gimplify.c:14141 0xac9fe8 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ../../gcc-11.2.0/gcc/gimplify.c:14253 0xacb35f gimplify_compound_lval ../../gcc-11.2.0/gcc/gimplify.c:3074 0xac81b1 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*= ), int) ../../gcc-11.2.0/gcc/gimplify.c:14046 0xad86b3 gimple_regimplify_operands(gimple*, gimple_stmt_iterator*) ../../gcc-11.2.0/gcc/gimplify-me.c:235 0xd907d2 copy_bb ../../gcc-11.2.0/gcc/tree-inline.c:2061 0xd91a64 copy_cfg_body ../../gcc-11.2.0/gcc/tree-inline.c:3048 0xd91a64 copy_body ../../gcc-11.2.0/gcc/tree-inline.c:3303 0xd94ccf expand_call_inline ../../gcc-11.2.0/gcc/tree-inline.c:5119 0xd96279 gimple_expand_calls_inline ../../gcc-11.2.0/gcc/tree-inline.c:5309 0xd96279 optimize_inline_calls(tree_node*) ../../gcc-11.2.0/gcc/tree-inline.c:5482 0x167957e early_inliner(function*) ../../gcc-11.2.0/gcc/ipa-inline.c:3007 The test case was heavily reduced, primarily without human interaction. I wouldn't be surprised if an incorrect use of a type punned pointer was part= of the original code around the problem area however. The ICE reproduces with "-O1 -finline-small-functions" instead of "-O2", but not with plain "-O1". I was able to reproduce it with compiler explorer using gcc with git hash 51018dd1395c72b3681ae5f84eceb94320472922, and 11.1, but not with 10.3 or earlier.=