Bug 110127 - -fimplicit-constexpr leads to extremely slow and memory intensive compilation
Summary: -fimplicit-constexpr leads to extremely slow and memory intensive compilation
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 13.1.0
: P3 normal
Target Milestone: 13.3
Assignee: Not yet assigned to anyone
URL:
Keywords: compile-time-hog
Depends on:
Blocks: constexpr
  Show dependency treegraph
 
Reported: 2023-06-05 14:29 UTC by fiesh
Modified: 2023-08-14 18:21 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 14.0
Known to fail: 12.1.0, 12.3.0, 13.1.0
Last reconfirmed: 2023-06-05 00:00:00


Attachments
Testcase for slow -fimplicit-constexpr (3.28 KB, text/plain)
2023-06-05 14:29 UTC, fiesh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fiesh 2023-06-05 14:29:56 UTC
Created attachment 55262 [details]
Testcase for slow -fimplicit-constexpr

The attached test case behaves as follows:

% time g++ -std=c++20 -o /dev/null -c u.ii
g++ -std=c++20 -o /dev/null -c u.ii  0.07s user 0.01s system 99% cpu 0.078 total

% time g++ -std=c++20 -o /dev/null -fimplicit-constexpr -c u.ii
g++ -std=c++20 -o /dev/null -fimplicit-constexpr -c u.ii  1637.98s user 41.63s system 99% cpu 27:59.91 total

The second run also consumes a large amount of memory in the region of 100GB.

I'm a bit stuck on how to reduce this further.
Comment 1 Patrick Palka 2023-06-05 16:43:55 UTC
Thanks for the bug report, confirmed with GCC 12.1,12.3, 13.1 and the 13 release branch, so not a regression.  On trunk the testcase compiles quickly ever since r14-409-g4b8d0d4d7fd245 for PR109678.  It seems backporting that commit to the 13 branch would fix the slowness there too.
Comment 2 fiesh 2023-06-06 06:47:37 UTC
Thank you for feedback!
Comment 3 Patrick Palka 2023-08-14 18:21:42 UTC
Fixed for GCC 13.3 after the backport r13-7713-gd3088f0ed25fe7.