Debian Codegraph @

gcc/testsuite/go.test/test/fixedbugs/issue12411.go

raw
1 // +build !386
2 // run
3
4 // Copyright 2015 The Go Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style
6 // license that can be found in the LICENSE file.
7
8 // Issue 12411. Loss of AX during %.
9
10 package main
11
12 func main() {
13 x := f(4)
14 if x != 0 {
15 println("BUG: x=", x)
16 }
17 }
18
19 //go:noinline
20 func f(x int) int {
21 // AX was live on entry to one of the % code generations,
22 // and the % code generation smashed it.
23 return ((2 * x) % 3) % (2 % ((x << 2) ^ (x % 3)))
24 }