summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-23 15:04:25 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-23 15:04:25 +0000
commit2a52910697a17e2af7c53514fbb81ab967e30a93 (patch)
tree058a7da8b45dfb04128883b6293a77b100704381
parentb4c71cbbafc2df58707ceb4e060a0b614dfb44d8 (diff)
downloadgcc-2a52910697a17e2af7c53514fbb81ab967e30a93.tar.gz
* tree-inline.c (remap_decl): Preserve DECL_ORIGINAL_TYPE invariant.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237734 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/tree-inline.c15
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9a1f732d259..ffa702a73f6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2016-06-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-inline.c (remap_decl): Preserve DECL_ORIGINAL_TYPE invariant.
+
2016-06-23 Andi Kleen <ak@linux.intel.com>
* Makefile.in: Regenerate.
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 07f6a83ff7c..a0d9e934e6d 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);