public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit 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: Tue, 17 Oct 2023 21:42:13 +0000	[thread overview]
Message-ID: <bug-111660-4-GTLFmsFhLm@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 #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:765c3b8f82d50961008c214ac2113f35e7532aa9

commit r14-4693-g765c3b8f82d50961008c214ac2113f35e7532aa9
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Oct 12 15:58:05 2023 -0400

    c++: Fix compile-time-hog in cp_fold_immediate_r [PR111660]

    My recent patch introducing cp_fold_immediate_r caused exponential
    compile time with nested COND_EXPRs.  The problem is that the COND_EXPR
    case recursively walks the arms of a COND_EXPR, but after processing
    both arms it doesn't end the walk; it proceeds to walk the
    sub-expressions of the outermost COND_EXPR, triggering again walking
    the arms of the nested COND_EXPR, and so on.  This patch brings the
    compile time down to about 0m0.030s.

    The ff_fold_immediate flag is unused after this patch but since I'm
    using it in the P2564 patch, I'm not removing it now.  Maybe at_eof
    can be used instead and then we can remove ff_fold_immediate.

            PR c++/111660

    gcc/cp/ChangeLog:

            * cp-gimplify.cc (cp_fold_immediate_r) <case COND_EXPR>: Don't
            handle it here.
            (cp_fold_r): Handle COND_EXPR here.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/hog1.C: New test.
            * g++.dg/cpp2a/consteval36.C: New test.

  parent reply	other threads:[~2023-10-17 21:42 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
2023-10-17 21:42 ` cvs-commit at gcc dot gnu.org [this message]
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-GTLFmsFhLm@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).