PR c++/91165 - verify_gimple ICE with cached constexpr.
authorJason Merrill <jason@redhat.com>
Mon, 16 Dec 2019 23:25:08 +0000 (18:25 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 16 Dec 2019 23:25:08 +0000 (18:25 -0500)
commit4953b790255db56883969fde37ad9fc82d2d6772
treec36979996f15c5fa2930bd6794a20373891e674d
parent126036359a27ee32a433d0404d88557bb0d15687
PR c++/91165 - verify_gimple ICE with cached constexpr.

It seems we need to unshare even non-CONSTRUCTOR expressions that we are
going to stick in the constexpr_call_table, so we don't end up sharing the
same e.g. ADDR_EXPR between two different functions.  I now think I
understand why unsharing CONSTRUCTOR arguments was improving memory
performance: separating the arguments from the caller function allows the
caller function to be GC'd better.  But it occurs to me that we don't need
to unshare until we decide that we're evaluating and caching this call, so
we can avoid the CONSTRUCTOR unshare/free pair for tentative arguments.
Freeing the tentative TREE_VEC still seems worth doing, so free_bindings
isn't going away entirely.

* constexpr.c (cxx_bind_parameters_in_call): Don't unshare.
(cxx_eval_call_expression): Unshare all args if we're caching.

From-SVN: r279447
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/testsuite/g++.dg/cpp0x/constexpr-string2.C [new file with mode: 0644]