This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70590] [6 Regression] r234810 causes error: location references block not in block tree
- From: "ppalka at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 08 Apr 2016 11:53:37 +0000
- Subject: [Bug c++/70590] [6 Regression] r234810 causes error: location references block not in block tree
- Auto-submitted: auto-generated
- References: <bug-70590-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70590
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(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?
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 7f4bb04..b2e27c1 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -4140,6 +4140,7 @@ cxx_eval_outermost_constant_expr (tree t, bool
allow_non_constant,
r = cxx_eval_constant_expression (&ctx, r,
false, &non_constant_p, &overflow_p);
+ r = unshare_expr (r);
verify_constant (r, allow_non_constant, &non_constant_p, &overflow_p);