From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BC0F3857B93; Tue, 11 Oct 2022 17:52:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BC0F3857B93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665510745; bh=4u4hZupv5PBhIOGikdH3I1Gxc2CR5ej2x3yjJSKv/H4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BzDYVHT3Zzh44pFci7e7L7t5DIWtQeWmCiAJvAjRJVQyjN+IQhV4Ya5VhV5Ha6uz0 pYK2TzyHeCmB4erK3nsGKnpfulrMUsGNtlb7EPIzG6eHHDX7N5rV8NOIQSiU2T2Qb1 One5sBH5BFaKkEhO70Eg+2g3lbOCT8y/D1a5lqoI= From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790 Date: Tue, 11 Oct 2022 17:52:24 +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.0 X-Bugzilla-Keywords: 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: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 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=3D106925 Marek Polacek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #3 from Marek Polacek --- I think the problem is that since r12-8066, in cxx_eval_vec_init we perform expand_vec_init_expr while processing the default argument, at which point start_preparsed_function hasn't yet set current_function_decl.=20 expand_vec_init_expr then leads to maybe_splice_retval_cleanup which checks DECL_CONSTRUCTOR_P (current_function_decl) without checking that current_function_decl is non-null first. It seems correct that current_function_decl is null at that point, so the fix should be just: --- a/gcc/cp/except.cc +++ b/gcc/cp/except.cc @@ -1327,6 +1327,7 @@ maybe_splice_retval_cleanup (tree compound_stmt) && current_binding_level->level_chain->kind =3D=3D sk_function_parm= s); if ((function_body || current_binding_level->kind =3D=3D sk_try) + && current_function_decl && !DECL_CONSTRUCTOR_P (current_function_decl) && !DECL_DESTRUCTOR_P (current_function_decl) && current_retval_sentinel)=