aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/typecheck/subr.go6
-rw-r--r--src/cmd/compile/internal/types/identity.go2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/typecheck/subr.go b/src/cmd/compile/internal/typecheck/subr.go
index e2f0a57e71..5ee4152e1c 100644
--- a/src/cmd/compile/internal/typecheck/subr.go
+++ b/src/cmd/compile/internal/typecheck/subr.go
@@ -1351,6 +1351,12 @@ func Shapify(t *types.Type) *types.Type {
// Map all types with the same underlying type to the same shape.
u := t.Underlying()
+ // All pointers have the same shape.
+ // TODO: Make unsafe.Pointer the same shape as normal pointers.
+ if u.Kind() == types.TPTR {
+ u = types.Types[types.TUINT8].PtrTo()
+ }
+
if s := shaped[u]; s != nil {
return s //TODO: keep?
}
diff --git a/src/cmd/compile/internal/types/identity.go b/src/cmd/compile/internal/types/identity.go
index 0a78092f07..dc39acced8 100644
--- a/src/cmd/compile/internal/types/identity.go
+++ b/src/cmd/compile/internal/types/identity.go
@@ -31,7 +31,7 @@ func identical(t1, t2 *Type, cmpTags bool, assumedEqual map[typePair]struct{}) b
if t1.sym != nil || t2.sym != nil {
if t1.HasShape() || t2.HasShape() {
switch t1.kind {
- case TINT8, TUINT8, TINT16, TUINT16, TINT32, TUINT32, TINT64, TUINT64, TINT, TUINT, TUINTPTR, TCOMPLEX64, TCOMPLEX128, TFLOAT32, TFLOAT64, TBOOL, TSTRING, TUNSAFEPTR:
+ case TINT8, TUINT8, TINT16, TUINT16, TINT32, TUINT32, TINT64, TUINT64, TINT, TUINT, TUINTPTR, TCOMPLEX64, TCOMPLEX128, TFLOAT32, TFLOAT64, TBOOL, TSTRING, TPTR, TUNSAFEPTR:
return true
}
// fall through to unnamed type comparison for complex types.