From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 090143858D28; Sat, 23 Mar 2024 08:06:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 090143858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711181165; bh=X/uyOi5aa081FaTmtvER36I5yntIf7+KUw+Ehf9gIVw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AK9a8h87sLjFAL3AuYL6taFkOdBqvUVxPkDz6PChJeTIvj0EdooEyuUhxkBv5pbhr qriXkSZoxT+IUtJ2VbevQeMPtTnwYaC7eclddMjS5/uHNeAACZwKmRmt26q45AZy8u oobsMfJE3AufoxtkF06285pDQzb7WZp+0+zCUn7U= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114426] [14 regression] ICE when building log4cxx on arm (cxx_eval_call_expression, at cp/constexpr.cc:3242) since r14-6507 Date: Sat, 23 Mar 2024 08:06:02 +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-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 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=3D114426 --- Comment #9 from Jakub Jelinek --- Unfortunately the above patch regressed g++.dg/opt/is_constant_evaluated3.C test. For constructors, even when they have VOID_TYPE_P, initialized_type actually returns non-VOID type, so constructors are optimized (though, dunno if not differently on arm where initialized_type will likely return class* while on other targets class). So, we'd need to treat that way just destructors (if it shouldn't be fixed elsewhere): 2024-03-23 Jakub Jelinek PR c++/114426 * cp-gimplify.cc (cp_fold): Don't call maybe_const_value on CALL_EXPRs to cdtors. * g++.dg/cpp2a/pr114426.C: New test. --- gcc/cp/cp-gimplify.cc.jj 2024-02-23 18:55:05.377594277 +0100 +++ gcc/cp/cp-gimplify.cc 2024-03-22 16:46:49.381442914 +0100 @@ -3395,7 +3395,13 @@ cp_fold (tree x, fold_flags_t flags) Do constexpr expansion of expressions where the call itself is n= ot constant, but the call followed by an INDIRECT_REF is. */ if (callee && DECL_DECLARED_CONSTEXPR_P (callee) - && !flag_no_inline) + && !flag_no_inline + /* Don't invoke it on dtors. On + !targetm.cxx.cdtor_returns_this () it won't do anything as it + has void type, so don't do it on + targetm.cxx.cdtor_returns_this () targets either for + consistency. */ + && !DECL_DESTRUCTOR_P (callee)) { mce_value manifestly_const_eval =3D mce_unknown; if (flags & ff_mce_false) --- gcc/testsuite/g++.dg/cpp2a/pr114426.C.jj 2024-03-22 16:49:55.6508828= 41 +0100 +++ gcc/testsuite/g++.dg/cpp2a/pr114426.C 2024-03-22 16:48:51.8297599= 97 +0100 @@ -0,0 +1,6 @@ +// PR c++/114426 +// { dg-do compile } + +struct A { virtual ~A (); }; +struct B : virtual A { virtual void foo () =3D 0; }; +struct C : B { C () {} };=