summaryrefslogtreecommitdiff
path: root/gcc/gimple-streamer-out.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-13 13:31:18 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-13 13:31:18 +0000
commitecfa1ceceed25e47bc35d7d34ed6dd99ad2b9944 (patch)
treedaa5e9d640693f6ab9ee02da3be5335a6bb04b19 /gcc/gimple-streamer-out.c
parentc12d6c79cba59276551a33d5f90e93683788bbf9 (diff)
downloadgcc-ecfa1ceceed25e47bc35d7d34ed6dd99ad2b9944.tar.gz
2013-02-13 Richard Biener <rguenther@suse.de>
PR lto/56295 * gimple-streamer-out.c (output_gimple_stmt): Undo wrapping globals in MEM_REFs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196013 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-streamer-out.c')
-rw-r--r--gcc/gimple-streamer-out.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index 24ab0ed7181..adf230ed93a 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -116,13 +116,14 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
for (i = 0; i < gimple_num_ops (stmt); i++)
{
tree op = gimple_op (stmt, i);
+ tree *basep = NULL;
/* Wrap all uses of non-automatic variables inside MEM_REFs
so that we do not have to deal with type mismatches on
merged symbols during IL read in. The first operand
of GIMPLE_DEBUG must be a decl, not MEM_REF, though. */
if (op && (i || !is_gimple_debug (stmt)))
{
- tree *basep = &op;
+ basep = &op;
while (handled_component_p (*basep))
basep = &TREE_OPERAND (*basep, 0);
if (TREE_CODE (*basep) == VAR_DECL
@@ -136,8 +137,13 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
(TREE_TYPE (*basep)), 0));
TREE_THIS_VOLATILE (*basep) = volatilep;
}
+ else
+ basep = NULL;
}
stream_write_tree (ob, op, true);
+ /* Restore the original base if we wrapped it inside a MEM_REF. */
+ if (basep)
+ *basep = TREE_OPERAND (TREE_OPERAND (*basep, 0), 0);
}
if (is_gimple_call (stmt))
{