From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A7FD13858420; Fri, 8 Dec 2023 18:34:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7FD13858420 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702060493; bh=0oYSeDpwNmymxds0rJF57OdcX12G03pNpnBeosj0chw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NyoF2tIsaO1WxzppRvoymgjOkVPtAQ83Q5FkLEksirPTIl/9gjOV1F5Sx+Hf+ddhh /EnNO9DExuwoHwiY5bZjzzJLvD3fIuBo9RCuZHYsYDFYSuI3nTyKKviHk7iRQagIo9 lzF62XRzCEXvbIzEDtlvwXtlMFrVDK/hShWVKJTs= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112658] [12/13 Regression] ICE: finish_expr_stmt with casting an temp array to pointer and constructor call Date: Fri, 08 Dec 2023 18:34:51 +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: 13.2.1 X-Bugzilla-Keywords: ice-on-valid-code, wrong-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: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 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=3D112658 --- Comment #7 from GCC Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:5764825aed613f201a8bc47e5b239027a39691f0 commit r14-6342-g5764825aed613f201a8bc47e5b239027a39691f0 Author: Patrick Palka Date: Fri Dec 8 13:33:55 2023 -0500 c++: undiagnosed error_mark_node from cp_build_c_cast [PR112658] When cp_build_c_cast commits to an erroneous const_cast, we neglect to replay errors from build_const_cast_1 which can lead to us incorrectly accepting (and "miscompiling") the cast, or triggering the assert in finish_expr_stmt. This patch fixes this oversight. This was the original fix for the ICE in PR112658 before r14-5941-g305a2686c99bf9 made us accept the testcase there after all. I wasn't able to come up with an alternate testcase f= or which this fix has an effect anymore, but below is a reduced version of the PR112658 testcase (accepted ever since r14-5941) for good measure. PR c++/112658 PR c++/94264 gcc/cp/ChangeLog: * typeck.cc (cp_build_c_cast): If we're committed to a const_ca= st and the result is erroneous, call build_const_cast_1 a second time to issue errors. Use complain=3Dtf_none instead of =3Dfal= se. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/initlist-array20.C: New test.=