https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Mon Dec 16 23:25:08 2019 New Revision: 279447 URL: https://gcc.gnu.org/viewcvs?rev=279447&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-string2.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c