https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70590

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Markus Trippelsdorf from comment #4)
> (In reply to Patrick Palka from comment #3)
> > (In reply to Jakub Jelinek from comment #2)
> > > location references block not in block tree generally means insufficient
> > > unsharing, where some function that got through gimple-low.c where
> > > TREE_SET_BLOCK has been used on some of the trees is sharing trees with a
> > > different function.
> > 
> > That makes sense.  So in cxx_eval_call_expression we should unconditionally
> > unshare the result of the call because the two caches (fundef_copies_table
> > and constexpr_call_table) may cause us to share the same trees in different
> > functions.  Alternatively we can just call unshare_expr once in the
> > top-level cxx_eval_outermost_constant_expression, I think.  Markus, does
> > this patch fix the build for you?
> 
> No. It now ICEs: in maybe_constant_value_1, at cp/constexpr.c:4328

What about just this instead?

diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 7f4bb04..7f485d2 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1558,7 +1558,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree
t,
     }

   pop_cx_call_context ();
-  return unshare_constructor (result);
+  return unshare_expr (result);
 }

 /* FIXME speed this up, it's taking 16% of compile time on sieve testcase.  */

Reply via email to