* Go patch committed: Skip stubs for ambiguous direct iface methods
@ 2022-06-16 19:26 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2022-06-16 19:26 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 838 bytes --]
This patch to the Go frontend by Михаил Аблакатов (Mikhail Ablakatov)
avoids generating stubs for ambiguous direct interface methods. The
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().
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
This fixes https://go.dev/issue/52870. The test case is
https://go.dev/cl/412535.
Committed to mainline.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 926 bytes --]
79d599b057cca42b84303ae25c7ab9f43e9f5eac
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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-16 19:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 19:26 Go patch committed: Skip stubs for ambiguous direct iface methods 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).