diff options
author | Richard Biener <rguenther@suse.de> | 2018-06-15 07:25:13 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-06-15 07:25:13 +0000 |
commit | 5b32ec103973c3b8f537c6e50fc8d954f27286de (patch) | |
tree | 8339b2aff1e9d29ab7aa60b7b6dd06cf3265a7d5 /gcc/tree-cfg.c | |
parent | a8ef8061e1ccbacff39065df65b5c17fbd01805a (diff) | |
download | gcc-5b32ec103973c3b8f537c6e50fc8d954f27286de.zip gcc-5b32ec103973c3b8f537c6e50fc8d954f27286de.tar.gz gcc-5b32ec103973c3b8f537c6e50fc8d954f27286de.tar.bz2 |
re PR tree-optimization/86076 (ICE: verify_gimple failed (error: location references block not in block tree))
2018-06-15 Richard Biener <rguenther@suse.de>
PR middle-end/86076
* tree-cfg.c (move_stmt_op): unshare invariant addresses
before adjusting their block.
* gcc.dg/pr86076.c: New testcase.
From-SVN: r261620
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) |