From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 297DD3858C50; Mon, 17 Jun 2024 23:24:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 297DD3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718666648; bh=KIEnRWiAlfc1ofpDNsRKJ7Rw4ZWzONPNQJsrOeb5nI0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cOcqPNhwaoIe+1uGp41OLeSBkDkheuuWCEKh9DtZ+W0AX5/xainI4AszKrGYbzp4q H1staPPnPjSsuppnaqF7oQzgzaJz3q0CZDaB2jjitV/MB1oj/OVZ/Wtl3ejlTNiocb hppkq+bQTRKpDb05qAz3Tbv3a6UbpwT8tP47hRvo= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115501] [13/14/15 Regression] ICE: in build_call_a with dynamic_cast after invalid definition of __cxxabiv1::__dynamic_cast since r13-3299 Date: Mon, 17 Jun 2024 23:24:07 +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: 15.0 X-Bugzilla-Keywords: error-recovery, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: 13.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115501 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pinskia at gcc dot gnu.org --- Comment #7 from Andrew Pinski --- (In reply to Marek Polacek from comment #6) > build_dynamic_cast_1 now calls pushdecl which calls duplicate_decls and t= hat > emits the "conflicting declaration" error and returns error_mark_node, so > the subsequent build_cxx_call crashes on the error_mark_node. >=20 > Maybe we need just: >=20 > --- a/gcc/cp/rtti.cc > +++ b/gcc/cp/rtti.cc > @@ -793,6 +793,8 @@ build_dynamic_cast_1 (location_t loc, tree type, tree > expr, > dcast_fn =3D pushdecl (dcast_fn, /*hiding=3D*/true); > pop_abi_namespace (flags); > dynamic_cast_node =3D dcast_fn; > + if (dcast_fn =3D=3D error_mark_node) > + return error_mark_node; > } > result =3D build_cxx_call (dcast_fn, 4, elems, complain); > SET_EXPR_LOCATION (result, loc); Most likely that check should be after the `!dcast_fn` check rather than in= side it so if you try to use dynamic_cast twice, the second one would not cause = an ICE.=