diff options
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 21b3fdf..78d80b0 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -6745,7 +6745,16 @@ move_stmt_op (tree *tp, int *walk_subtrees, void *data) ; else if (block == p->orig_block || p->orig_block == NULL_TREE) - TREE_SET_BLOCK (t, p->new_block); + { + /* tree_node_can_be_shared says we can share invariant + addresses but unshare_expr copies them anyways. Make sure + to unshare before adjusting the block in place - we do not + always see a copy here. */ + if (TREE_CODE (t) == ADDR_EXPR + && is_gimple_min_invariant (t)) + *tp = t = unshare_expr (t); + TREE_SET_BLOCK (t, p->new_block); + } else if (flag_checking) { while (block && TREE_CODE (block) == BLOCK && block != p->orig_block) |