Reported by Jan Mercl on golang-dev@
What version of Go are you using (go version)?
$ go version
go version go1.21rc2 linux/ppc64le
What operating system and processor architecture are you using (go env)?
$ uname -a
Linux sqlite1 5.10.0-18-powerpc64le #1 SMP Debian 5.10.140-1 (2022-09-02) ppc64le GNU/Linux
What did you do?
Minimized reproducer at https://go.dev/play/p/ccmhhPkt0PI?v=gotip outputs
in the playground. Running the same code on linux/ppc64le:
debian@sqlite1:~/tmp$ cat bug.go
package main
import (
"fmt"
"strconv"
)
func f(n int) int8 {
return int8(n)
}
func main() {
n, _ := strconv.Atoi("9")
fmt.Println(int64(0xd7f2) & int64(f(-n)))
fmt.Println(int64(0xd7f2) & int64(f(-9)))
}
debian@sqlite1:~/tmp$ go run bug.go
242
55282
Reported by Jan Mercl on golang-dev@
What version of Go are you using (
go version)?What operating system and processor architecture are you using (
go env)?$ uname -a Linux sqlite1 5.10.0-18-powerpc64le #1 SMP Debian 5.10.140-1 (2022-09-02) ppc64le GNU/LinuxWhat did you do?
Minimized reproducer at https://go.dev/play/p/ccmhhPkt0PI?v=gotip outputs
in the playground. Running the same code on linux/ppc64le: