[Bug c++/55442] G++ uses up all my RAM when compiling a constexpr with exponential call graph
jason at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 27 21:29:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55442
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Thu Jun 27 21:29:19 2019
New Revision: 272765
URL: https://gcc.gnu.org/viewcvs?rev=272765&root=gcc&view=rev
Log:
PR c++/55442 - memory-hog with highly recursive constexpr.
This testcase in the PR is extremely recursive, and therefore uses a huge
amount of memory on caching the results of individual calls. We no longer
need to track all calls to catch infinite recursion, as we have other limits
on maximum depth and operations count. So let's only cache a few calls at
the top level: 8 seems to be a reasonable compromise.
gcc/c-family/
* c.opt (fconstexpr-loop-limit): New.
gcc/cp/
* constexpr.c (push_cx_call_context): Return depth.
(cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/constexpr.c
trunk/gcc/doc/invoke.texi
More information about the Gcc-bugs
mailing list