From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 50369384A06B; Wed, 15 May 2024 17:28:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50369384A06B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715794094; bh=0mGj8gCC3dyE8f5xAC8kaeey4NRw6TKMXiYlR1ZRHI4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=j7hbYQlkCsjSA9aoNvnM80/UsHlfLy5w+tW5OzaRclPiMYOfz4h79YJgWj/y//cHV 71RkVyTaqYqCNxr4T76VrvV7kvVHfNwCcg3Vz2jFSPeutDoylZt5fP96ppajJh73/L GVDvSow2q7415n86eAYUvzAPf2GhhkCC7pFRfSoo= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114854] [11/12/13/14/15 Regression] checking ICE with default initializer of const reference member at cp/cp-gimplify.cc:900 since r10-5822 Date: Wed, 15 May 2024 17:28:12 +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: 14.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114854 --- Comment #3 from GCC Commits --- The trunk branch has been updated by Marek Polacek : https://gcc.gnu.org/g:1a05332bbac98a4c002bef3fb45a3ad9d56b3a71 commit r15-523-g1a05332bbac98a4c002bef3fb45a3ad9d56b3a71 Author: Marek Polacek Date: Wed May 8 15:43:58 2024 -0400 c++: ICE with reference NSDMI [PR114854] Here we crash on a cp_gimplify_expr/TARGET_EXPR assert: /* A TARGET_EXPR that expresses direct-initialization should have been elided by cp_gimplify_init_expr. */ gcc_checking_assert (!TARGET_EXPR_DIRECT_INIT_P (*expr_p)); the TARGET_EXPR in question is created for the NSDMI in: class Vector { int m_size; }; struct S { const Vector &vec{}; }; where we first need to create a Vector{} temporary, and then bind the vec reference to it. The temporary is represented by a TARGET_EXPR and it cannot be elided. When we create an object of type S, we get D.2848 =3D {.vec=3D(const struct Vector &) &TARGET_EXPR } where the TARGET_EXPR is no longer direct-initializing anything. Fixed by not setting TARGET_EXPR_DIRECT_INIT_P in convert_like_internal/ck_user. PR c++/114854 gcc/cp/ChangeLog: * call.cc (convert_like_internal) : Don't set TARGET_EXPR_DIRECT_INIT_P. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/nsdmi-aggr22.C: New test.=