aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2016-06-23 15:04:25 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2016-06-23 15:04:25 +0000
commitcd64be5bcae8c6f0ccf50aac0e0a16f28e23d042 (patch)
tree058a7da8b45dfb04128883b6293a77b100704381 /gcc/tree-inline.c
parent277d7ee0c95456a21ef371aa025791cbef883169 (diff)
downloadgcc-cd64be5bcae8c6f0ccf50aac0e0a16f28e23d042.zip
gcc-cd64be5bcae8c6f0ccf50aac0e0a16f28e23d042.tar.gz
gcc-cd64be5bcae8c6f0ccf50aac0e0a16f28e23d042.tar.bz2
* tree-inline.c (remap_decl): Preserve DECL_ORIGINAL_TYPE invariant.
From-SVN: r237734
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 07f6a83..a0d9e93 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -367,7 +367,20 @@ remap_decl (tree decl, copy_body_data *id)
/* Remap types, if necessary. */
TREE_TYPE (t) = remap_type (TREE_TYPE (t), id);
if (TREE_CODE (t) == TYPE_DECL)
- DECL_ORIGINAL_TYPE (t) = remap_type (DECL_ORIGINAL_TYPE (t), id);
+ {
+ DECL_ORIGINAL_TYPE (t) = remap_type (DECL_ORIGINAL_TYPE (t), id);
+
+ /* Preserve the invariant that DECL_ORIGINAL_TYPE != TREE_TYPE,
+ which is enforced in gen_typedef_die when DECL_ABSTRACT_ORIGIN
+ is not set on the TYPE_DECL, for example in LTO mode. */
+ if (DECL_ORIGINAL_TYPE (t) == TREE_TYPE (t))
+ {
+ tree x = build_variant_type_copy (TREE_TYPE (t));
+ TYPE_STUB_DECL (x) = TYPE_STUB_DECL (TREE_TYPE (t));
+ TYPE_NAME (x) = t;
+ DECL_ORIGINAL_TYPE (t) = x;
+ }
+ }
/* Remap sizes as necessary. */
walk_tree (&DECL_SIZE (t), copy_tree_body_r, id, NULL);