diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-04-17 18:19:44 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-04-17 18:19:44 +0000 |
commit | 90e00f872d715c6d54742e6bbcafa2ce4f033dc8 (patch) | |
tree | e4fe10e347023d58baaa566c58cf2424111004f8 /libgo | |
parent | fdce7c12f37a334c1af1ee86b7f7755cf98a5bca (diff) | |
download | gcc-90e00f872d715c6d54742e6bbcafa2ce4f033dc8.zip gcc-90e00f872d715c6d54742e6bbcafa2ce4f033dc8.tar.gz gcc-90e00f872d715c6d54742e6bbcafa2ce4f033dc8.tar.bz2 |
re PR go/65755 (incorrect reflection of struct fields with gccgo)
PR go/65755
compiler, runtime, reflect: Use reflection string for type comparisons.
Change the runtime and reflect libraries to always use only
the type reflection string to determine whether two types are
equal. It previously used the PkgPath and Name values for a
type name, but that required a PkgPath that did not match the
gc compiler.
Change the compiler to use the same PkgPath value as the gc
compiler in all cases.
Change the compiler to put the receiver type in the reflection
string for a type defined inside a method.
From-SVN: r222194
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/go/reflect/type.go | 8 | ||||
-rw-r--r-- | libgo/runtime/go-typedesc-equal.c | 11 |
2 files changed, 1 insertions, 18 deletions
diff --git a/libgo/go/reflect/type.go b/libgo/go/reflect/type.go index 5cbf7e5..7f0c6a8 100644 --- a/libgo/go/reflect/type.go +++ b/libgo/go/reflect/type.go @@ -1940,13 +1940,7 @@ func canonicalize(t Type) Type { if t == nil { return nil } - u := t.uncommon() - var s string - if u == nil || u.PkgPath() == "" { - s = t.rawString() - } else { - s = u.PkgPath() + "." + u.Name() - } + s := t.rawString() canonicalTypeLock.RLock() if r, ok := canonicalType[s]; ok { canonicalTypeLock.RUnlock() diff --git a/libgo/runtime/go-typedesc-equal.c b/libgo/runtime/go-typedesc-equal.c index f8474fc..90079f2 100644 --- a/libgo/runtime/go-typedesc-equal.c +++ b/libgo/runtime/go-typedesc-equal.c @@ -24,16 +24,5 @@ __go_type_descriptors_equal (const struct __go_type_descriptor *td1, return 0; if (td1->__code != td2->__code || td1->__hash != td2->__hash) return 0; - if (td1->__uncommon != NULL && td1->__uncommon->__name != NULL) - { - if (td2->__uncommon == NULL || td2->__uncommon->__name == NULL) - return 0; - return (__go_ptr_strings_equal (td1->__uncommon->__name, - td2->__uncommon->__name) - && __go_ptr_strings_equal (td1->__uncommon->__pkg_path, - td2->__uncommon->__pkg_path)); - } - if (td2->__uncommon != NULL && td2->__uncommon->__name != NULL) - return 0; return __go_ptr_strings_equal (td1->__reflection, td2->__reflection); } |