1
0
mirror of https://github.com/golang/go synced 2024-11-24 12:50:11 -07:00
go/test/fixedbugs/issue12133.go
Keith Randall e97ab0a0ac cmd/compile: remove stale register use array
The reg[] array in .../gc is where truth lies.  The copy in .../ARCH
is incorrect as it is mostly not updated to reflect regalloc decisions.

This bug was introduced in the rewrite
https://go-review.googlesource.com/#/c/7853/.  The new reg[] array was
introduced in .../gc but not all of the uses were removed in the
.../ARCH directories.

Fixes #12133

Change-Id: I6364fc403cdab92d802d17f2913ba1607734037c
Reviewed-on: https://go-review.googlesource.com/13630
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-15 17:37:14 +00:00

27 lines
541 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.
// Issue 12133. The CX register was getting clobbered
// because we did not keep track of its allocation correctly.
package main
import "fmt"
func main() {
want := uint(48)
got := f1(48)
if got != want {
fmt.Println("got", got, ", wanted", want)
panic("bad")
}
}
func f1(v1 uint) uint {
switch {
} // prevent inlining
return v1 >> ((1 >> v1) + (1 >> v1))
}