Commit 5ec87ba5 authored by David Chase's avatar David Chase

cmd/compile: fix.gc.Type.cmp for map.notBucket cmp map.Bucket

Comparison of certain map types could fail to be antisymmetric.
This corrects that.

Change-Id: I88c6256053ce29950ced4ba4d538e241ee8591fe
Reviewed-on: https://go-review.googlesource.com/22552
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarjcd . <jcd@golang.org>
Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent 9faf5cdf
...@@ -992,6 +992,8 @@ func (t *Type) cmp(x *Type) ssa.Cmp { ...@@ -992,6 +992,8 @@ func (t *Type) cmp(x *Type) ssa.Cmp {
return ssa.CMPlt // bucket maps are least return ssa.CMPlt // bucket maps are least
} }
return t.StructType().Map.cmp(x.StructType().Map) return t.StructType().Map.cmp(x.StructType().Map)
} else if x.StructType().Map.MapType().Bucket == x {
return ssa.CMPgt // bucket maps are least
} // If t != t.Map.Bucket, fall through to general case } // If t != t.Map.Bucket, fall through to general case
fallthrough fallthrough
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment