PR c++/55442 - memory-hog with highly recursive constexpr.
authorJason Merrill <jason@redhat.com>
Thu, 27 Jun 2019 21:29:19 +0000 (17:29 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 27 Jun 2019 21:29:19 +0000 (17:29 -0400)
commit7ffc7de55b058e78cbc46803b89b712849ea35b3
tree45cdc9befe6ccde50d84263ddfe64923c8a031a9
parent95bb6e7a56d17f5f8886815f85dff71d12964245
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.

From-SVN: r272765
gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/doc/invoke.texi