public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Use build_variant_type_copy, not build_distinct_type_copy
@ 2018-06-28 17:46 Ian Lance Taylor
  2019-01-09 23:39 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Lance Taylor @ 2018-06-28 17:46 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

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.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 503 bytes --]

Index: go-gcc.cc
===================================================================
--- go-gcc.cc	(revision 262150)
+++ go-gcc.cc	(working copy)
@@ -1100,7 +1100,7 @@ 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_distinct_type_copy(t);
+      tree copy = build_variant_type_copy(t);
       TYPE_NAME(copy) = NULL_TREE;
       DECL_ORIGINAL_TYPE(TYPE_NAME(t)) = copy;
     }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Go patch committed: Use build_variant_type_copy, not build_distinct_type_copy
  2018-06-28 17:46 Go patch committed: Use build_variant_type_copy, not build_distinct_type_copy Ian Lance Taylor
@ 2019-01-09 23:39 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2019-01-09 23:39 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]

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.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 687 bytes --]

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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-09 23:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-28 17:46 Go patch committed: Use build_variant_type_copy, not build_distinct_type_copy Ian Lance Taylor
2019-01-09 23:39 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).