1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:14:42 -07:00
go/test/fixedbugs/issue12226.go
Ulrich Kunitz 6ec1809b83 cmd/compile: fix register allocation for == operator
The issue 12226 has been caused by the allocation of the same register
for the equality check of two byte values. The code in cgen.go freed the
register for the second operand before the allocation of the register
for the first operand.

Fixes #12226

Change-Id: Ie4dc33a488bd48a17f8ae9b497fd63c1ae390555
Reviewed-on: https://go-review.googlesource.com/13771
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-25 18:10:14 +00:00

16 lines
331 B
Go

// run
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "fmt"
func main() {
if []byte("foo")[0] == []byte("b")[0] {
fmt.Println("BUG: \"foo\" and \"b\" appear to have the same first byte")
}
}