cmd/compile: fix PtrTo(t) for unnamed t with embedded fields

Fixes #8427.

Change-Id: I826a3bc4519845ad30d6dbaf058fe7ed7bee8db0
Reviewed-on: https://go-review.googlesource.com/12233
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go
index 08343e8..fcb9b17 100644
--- a/src/cmd/compile/internal/gc/reflect.go
+++ b/src/cmd/compile/internal/gc/reflect.go
@@ -760,10 +760,11 @@
 	}
 
 	var sptr *Sym
-	if t.Sym != nil && !Isptr[t.Etype] {
-		sptr = dtypesym(Ptrto(t))
+	tptr := Ptrto(t)
+	if !Isptr[t.Etype] && (t.Sym != nil || methods(tptr) != nil) {
+		sptr = dtypesym(tptr)
 	} else {
-		sptr = weaktypesym(Ptrto(t))
+		sptr = weaktypesym(tptr)
 	}
 
 	// All (non-reflect-allocated) Types share the same zero object.