public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1140] compiler: don't generate stubs for ambiguous direct interface methods
Date: Thu, 16 Jun 2022 19:26:25 +0000 (GMT)	[thread overview]
Message-ID: <20220616192625.20BC03857B80@sourceware.org> (raw)

https://gcc.gnu.org/g:b2aaa44d2c9c0e5a31688a6e40a7b132dd03338a

commit r13-1140-gb2aaa44d2c9c0e5a31688a6e40a7b132dd03338a
Author: Mikhail Ablakatov <ablakatov.m@gmail.com>
Date:   Thu May 12 21:45:35 2022 +0300

    compiler: don't generate stubs for ambiguous direct interface methods
    
    Current implementation checks whether it has to generate a stub method for a
    promoted method of an embedded struct field in Type::build_stub_methods(). If
    the promoted method is ambiguous it's simply skipped. But struct types that
    can fit in an interface value (e.g. structs that consist of a single pointer
    field) get a second chance in Type::build_direct_iface_stub_methods().
    
    This patch adds the same check used by Type::build_stub_methods() to
    Type::build_direct_iface_stub_methods().
    
    Fixes golang/go#52870
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405974

Diff:
---
 gcc/go/gofrontend/MERGE    | 2 +-
 gcc/go/gofrontend/types.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index aeada9f8d0c..0cda305c648 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-bbb3a4347714faee620dc205674510a0f20b81ae
+8db6b78110f84e22c409f334aeaefb80a8b39917
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index a8e309041e7..eb3afd94682 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -11891,7 +11891,7 @@ Type::build_direct_iface_stub_methods(Gogo* gogo, const Type* type,
         need_stub = true;
       if (!in_heap && !m->is_value_method())
         need_stub = true;
-      if (!need_stub)
+      if (!need_stub || m->is_ambiguous())
         continue;
 
       Type* receiver_type = const_cast<Type*>(type);


                 reply	other threads:[~2022-06-16 19:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220616192625.20BC03857B80@sourceware.org \
    --to=ian@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).