aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/reflect
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2017-02-17 15:43:39 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-02-17 15:43:39 +0000
commit00b2a30fd4df92fe5ea879295d65c55bf1725fcb (patch)
tree01db6511f47b5c9c301fa6f57b0df9376c364fd5 /libgo/go/reflect
parent4bcd6597a33c86615059873504b3140f49c3b96c (diff)
downloadgcc-00b2a30fd4df92fe5ea879295d65c55bf1725fcb.zip
gcc-00b2a30fd4df92fe5ea879295d65c55bf1725fcb.tar.gz
gcc-00b2a30fd4df92fe5ea879295d65c55bf1725fcb.tar.bz2
libgo: update to final Go 1.8 release
Along with the update this fixes a problem that was always present but only showed up with the new reflect test. When a program used a **unsafe.Pointer and stored the value in an interface type, the generated type descriptor pointed to the GC data for *unsafe.Pointer. It did that by name, but we were not generating a variable with the right name. Reviewed-on: https://go-review.googlesource.com/37144 From-SVN: r245535
Diffstat (limited to 'libgo/go/reflect')
-rw-r--r--libgo/go/reflect/all_test.go13
-rw-r--r--libgo/go/reflect/type.go1
2 files changed, 11 insertions, 3 deletions
diff --git a/libgo/go/reflect/all_test.go b/libgo/go/reflect/all_test.go
index 6b143df..859de7c 100644
--- a/libgo/go/reflect/all_test.go
+++ b/libgo/go/reflect/all_test.go
@@ -2481,17 +2481,24 @@ func TestNumMethodOnDDD(t *testing.T) {
}
func TestPtrTo(t *testing.T) {
+ // This block of code means that the ptrToThis field of the
+ // reflect data for *unsafe.Pointer is non zero, see
+ // https://golang.org/issue/19003
+ var x unsafe.Pointer
+ var y = &x
+ var z = &y
+
var i int
- typ := TypeOf(i)
+ typ := TypeOf(z)
for i = 0; i < 100; i++ {
typ = PtrTo(typ)
}
for i = 0; i < 100; i++ {
typ = typ.Elem()
}
- if typ != TypeOf(i) {
- t.Errorf("after 100 PtrTo and Elem, have %s, want %s", typ, TypeOf(i))
+ if typ != TypeOf(z) {
+ t.Errorf("after 100 PtrTo and Elem, have %s, want %s", typ, TypeOf(z))
}
}
diff --git a/libgo/go/reflect/type.go b/libgo/go/reflect/type.go
index 29d89f7..0325260 100644
--- a/libgo/go/reflect/type.go
+++ b/libgo/go/reflect/type.go
@@ -1174,6 +1174,7 @@ func (t *rtype) ptrTo() *rtype {
pp := *prototype
pp.string = &s
+ pp.ptrToThis = nil
// For the type structures linked into the binary, the
// compiler provides a good hash of the string.