summaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-in.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-17 11:47:56 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-17 11:47:56 +0000
commitb2dd75cb9cd962dbc29c20ead99de15698ad2409 (patch)
tree5f2c05e10cf62e9694f8a7dd24def3a5520b8342 /gcc/lto-streamer-in.c
parent50835c78805d6c053ad3f570f3b1224a32a75334 (diff)
downloadgcc-b2dd75cb9cd962dbc29c20ead99de15698ad2409.tar.gz
2009-10-17 Richard Guenther <rguenther@suse.de>
* lto-streamer-in.c (input_gimple_stmt): Fixup FIELD_DECL operands in COMPONENT_REFs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152937 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r--gcc/lto-streamer-in.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 71faf0f39f6..45be0c2d47b 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -1061,6 +1061,36 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
{
tree op = lto_input_tree (ib, data_in);
gimple_set_op (stmt, i, op);
+
+ /* Fixup FIELD_DECLs. */
+ while (op && handled_component_p (op))
+ {
+ if (TREE_CODE (op) == COMPONENT_REF)
+ {
+ tree field, type, tem;
+ field = TREE_OPERAND (op, 1);
+ type = DECL_CONTEXT (field);
+ for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
+ {
+ if (tem == field
+ || (TREE_TYPE (tem) == TREE_TYPE (field)
+ && (DECL_FIELD_OFFSET (tem)
+ == DECL_FIELD_OFFSET (field))
+ && (DECL_FIELD_BIT_OFFSET (tem)
+ == DECL_FIELD_BIT_OFFSET (field))
+ && (DECL_OFFSET_ALIGN (tem)
+ == DECL_OFFSET_ALIGN (field))))
+ break;
+ }
+ /* In case of type mismatches across units we can fail
+ to unify some types and thus not find a proper
+ field-decl here. Just do nothing in this case. */
+ if (tem != NULL_TREE)
+ TREE_OPERAND (op, 1) = tem;
+ }
+
+ op = TREE_OPERAND (op, 0);
+ }
}
break;