]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: fix.gc.Type.cmp for map.notBucket cmp map.Bucket
authorDavid Chase <drchase@google.com>
Thu, 28 Apr 2016 14:46:08 +0000 (10:46 -0400)
committerDavid Chase <drchase@google.com>
Thu, 28 Apr 2016 15:36:34 +0000 (15:36 +0000)
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: jcd . <jcd@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/type.go

index 9f049babc28a4f31b782f649f8ec34ea99dd0374..9ae05f7ff1f1a5e5b7af11dd3ac0ffb6168e0fcf 100644 (file)
@@ -992,6 +992,8 @@ func (t *Type) cmp(x *Type) ssa.Cmp {
                                return ssa.CMPlt // bucket maps are least
                        }
                        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
 
                fallthrough