From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9B0503858401; Thu, 12 Oct 2023 19:17:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B0503858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697138259; bh=6gWn+Tya8I8yCrox7A81NxpIVa7eQ3ENJVEZUWFQlkc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=o7gUvywBfw7ZmaZLQmnex5HP2a8Dkuk4YrkmUJODwJTtm2ogUWofJv8gHqFi7KNsj fIQmx1HSPu6BIyU8YJuOC2jKWS9BtMUSqeV4kB9DIc49jQkEFktJjZNbH7mm1M5bxu mJJkfaT5FRsVt6bNxiUSPVNnMRl5vJiaK6V+HVlo= From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111660] [14 Regression] Compilation of constexpr function returning enum takes exponential time with -std=c++2a since r14-4140-g6851e3423c2b5e Date: Thu, 12 Oct 2023 19:17:38 +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: compile-time-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: mpolacek 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=3D111660 --- Comment #12 from Marek Polacek --- Candidate fix: --- a/gcc/cp/cp-gimplify.cc +++ b/gcc/cp/cp-gimplify.cc @@ -1072,7 +1072,7 @@ cp_fold_immediate_r (tree *stmt_p, int *walk_subtrees, void *data_) /* We're done here. Don't clear *walk_subtrees here though: we're called from cp_fold_r and we must let it recurse on the expression with cp_fold. */ - break; + return integer_zero_node; case PTRMEM_CST: if (TREE_CODE (PTRMEM_CST_MEMBER (stmt)) =3D=3D FUNCTION_DECL && DECL_IMMEDIATE_FUNCTION_P (PTRMEM_CST_MEMBER (stmt))) @@ -1145,7 +1145,8 @@ cp_fold_immediate (tree *tp, mce_value manifestly_const_eval) flags |=3D ff_mce_false; cp_fold_data data (flags); - return !!cp_walk_tree_without_duplicates (tp, cp_fold_immediate_r, &data= ); + tree r =3D cp_walk_tree_without_duplicates (tp, cp_fold_immediate_r, &da= ta); + return r =3D=3D error_mark_node; } /* Perform any pre-gimplification folding of C++ front end trees to=