public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-111660-4-bPvWTOpfzd@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111660-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111660

--- Comment #12 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
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)) == 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 |= ff_mce_false;

   cp_fold_data data (flags);
-  return !!cp_walk_tree_without_duplicates (tp, cp_fold_immediate_r, &data);
+  tree r = cp_walk_tree_without_duplicates (tp, cp_fold_immediate_r, &data);
+  return r == error_mark_node;
 }

 /* Perform any pre-gimplification folding of C++ front end trees to

  parent reply	other threads:[~2023-10-12 19:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02  1:14 [Bug c++/111660] New: Compilation of constexpr function returning enum takes exponential time with -std=c++2a envia at envia dot pe.kr
2023-10-02  1:16 ` [Bug c++/111660] " envia at envia dot pe.kr
2023-10-02  1:17 ` envia at envia dot pe.kr
2023-10-02  1:18 ` envia at envia dot pe.kr
2023-10-02  1:24 ` envia at envia dot pe.kr
2023-10-02  1:26 ` pinskia at gcc dot gnu.org
2023-10-02  1:26 ` pinskia at gcc dot gnu.org
2023-10-02  1:31 ` pinskia at gcc dot gnu.org
2023-10-02  1:33 ` [Bug c++/111660] [14 Regression] " pinskia at gcc dot gnu.org
2023-10-02  1:39 ` envia at envia dot pe.kr
2023-10-02  2:39 ` envia at envia dot pe.kr
2023-10-02 13:34 ` ppalka at gcc dot gnu.org
2023-10-02 14:43 ` mpolacek at gcc dot gnu.org
2023-10-04  9:41 ` [Bug c++/111660] [14 Regression] Compilation of constexpr function returning enum takes exponential time with -std=c++2a since r14-4140-g6851e3423c2b5e rguenth at gcc dot gnu.org
2023-10-12 19:17 ` mpolacek at gcc dot gnu.org [this message]
2023-10-17 21:42 ` cvs-commit at gcc dot gnu.org
2023-10-17 21:43 ` mpolacek at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-111660-4-bPvWTOpfzd@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).