From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 18FF83857404; Fri, 25 Mar 2022 20:08:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18FF83857404 From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104583] [10/11/12 regression] ICE dolphin-emu at cp/cp-gimplify.cc:746 Date: Fri, 25 Mar 2022 20:08:26 +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: 12.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: 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: Fri, 25 Mar 2022 20:08:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104583 Marek Polacek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #3 from Marek Polacek --- The attached 93280 test no longer ICEs but looks like it was never added to= the testsuite. The 104583 test, modified so that it closely resembles 93280, s= till ICEs. The problem is that in 104583 we have a value-init from {}, so this code in convert_like_internal 7960 /* If we're initializing from {}, it's value-initialization. = */ 7961 if (BRACE_ENCLOSED_INITIALIZER_P (expr) 7962 && CONSTRUCTOR_NELTS (expr) =3D=3D 0 7963 && TYPE_HAS_DEFAULT_CONSTRUCTOR (totype) 7964 && !processing_template_decl) 7965 { 7966 bool direct =3D CONSTRUCTOR_IS_DIRECT_INIT (expr); ... 7974 TARGET_EXPR_DIRECT_INIT_P (expr) =3D direct; sets TARGET_EXPR_DIRECT_INIT_P (line #1 in 104583). This does not happen in 93280. When gimplifying, the #2 line, we have d =3D {.a=3DTARGET_EXPR >> >>>>} where the TARGET_EXPR is the one with TARGET_EXPR_DIRECT_INIT_P set. In gimplify_init_ctor_preeval we do 4724 FOR_EACH_VEC_SAFE_ELT (v, ix, ce) 4725 gimplify_init_ctor_preeval (&ce->value, pre_p, post_p, data); so we gimplify the TARGET_EXPR, crashing at 744 case TARGET_EXPR: 745 /* A TARGET_EXPR that expresses direct-initialization should have been 746 elided by cp_gimplify_init_expr. */ 747 gcc_checking_assert (!TARGET_EXPR_DIRECT_INIT_P (*expr_p)); but there is no INIT_EXPR so cp_gimplify_init_expr was never called! // 93280.C struct A { template A(T); int c; }; struct D { A a{0}; }; void f() { D d; d =3D {}; } // 104583.C struct A { A(); int c; }; struct D { A a{}; // #1 }; void g() { D d; d =3D {}; // #2 }=