Go patch committed: Use build_variant_type_copy, not build_distinct_type_copy
Ian Lance Taylor
iant@golang.org
Wed Jan 9 23:39:00 GMT 2019
On Thu, Jun 28, 2018 at 10:46 AM Ian Lance Taylor <iant@golang.org> wrote:
>
> This patch to the Go frontend changes set_placeholder_struct_type to
> use build_variant_type_copy rather than build_distinct_type_copy.
> This is for PR 86343, which noted that the DECL_CONTEXT of the fields
> in the copy were pointing to the wrong type. Using
> build_variant_type_copy puts the types in right relationship for the
> DECL_CONTEXT setting. Bootstrapped and ran Go testsuite on
> x86_64-pc-linux-gnu. Committed to mainline.
>
> Ian
>
> 2018-06-28 Ian Lance Taylor <iant@golang.org>
>
> PR go/86343
> * go-gcc.cc (Gcc_backend::set_placeholder_struct_type): Call
> build_variant_type_copy rather than build_distinct_type_copy.
It turns out that this old patch broke gccgo's debug info for named
struct types. Updated as follows, which seems to work better.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed
to mainline.
Ian
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.
-------------- next part --------------
Index: go-gcc.cc
===================================================================
--- go-gcc.cc (revision 267788)
+++ go-gcc.cc (working copy)
@@ -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;
More information about the Gcc-patches
mailing list