aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-01-09 23:38:55 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-01-09 23:38:55 +0000
commiteea11d66bcc0a549fa95f71a7a6bfb97a8dbc7e1 (patch)
tree97d2f8c5a4176c72fd345c54c732f39008561f0f
parent9fa27ed0884b23d37f2f0b7ee2edd427664aa557 (diff)
downloadgcc-eea11d66bcc0a549fa95f71a7a6bfb97a8dbc7e1.zip
gcc-eea11d66bcc0a549fa95f71a7a6bfb97a8dbc7e1.tar.gz
gcc-eea11d66bcc0a549fa95f71a7a6bfb97a8dbc7e1.tar.bz2
re PR go/86343 (types built by GO share TYPE_FIELDS in unsupported way)
PR go/86343 * go-gcc.cc (Gcc_backend::set_placeholder_struct_type): Go back to build_distinct_type_copy, but copy the fields so that they have the right DECL_CONTEXT. From-SVN: r267789
-rw-r--r--gcc/go/ChangeLog7
-rw-r--r--gcc/go/go-gcc.cc6
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index 64e20cd..0a579bd 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,10 @@
+2019-01-09 Ian Lance Taylor <iant@golang.org>
+
+ PR go/86343
+ * go-gcc.cc (Gcc_backend::set_placeholder_struct_type): Go back to
+ build_distinct_type_copy, but copy the fields so that they have
+ the right DECL_CONTEXT.
+
2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
PR other/16615
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index afdc7f8..7fbdd07 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -1098,9 +1098,13 @@ Gcc_backend::set_placeholder_struct_type(
if (TYPE_NAME(t) != NULL_TREE)
{
// Build the data structure gcc wants to see for a typedef.
- tree copy = build_variant_type_copy(t);
+ tree copy = build_distinct_type_copy(t);
TYPE_NAME(copy) = NULL_TREE;
DECL_ORIGINAL_TYPE(TYPE_NAME(t)) = copy;
+ TYPE_SIZE(copy) = NULL_TREE;
+ Btype* bc = this->make_type(copy);
+ this->fill_in_struct(bc, fields);
+ delete bc;
}
return r->get_tree() != error_mark_node;