Go1.15.5 linux/arm: Possible bug

336 views
Skip to first unread message

Jan Mercl

unread,
Nov 25, 2020, 5:32:57 AM11/25/20
to golang-dev
Observation:

jnml@pi32:~$ go version
go version go1.15.5 linux/arm
jnml@pi32:~$ uname -a
Linux pi32 5.4.72-v7l+ #1356 SMP Thu Oct 22 13:57:51 BST 2020 armv7l GNU/Linux
jnml@pi32:~$ cat main.go
package main

import "fmt"

var x = [4]int32{((-0x7fffffff - 1) / 2), 0x7fffffff, 2, 4} /* 20041210-1.c:5:5 */

func main() { /* 20041210-1.c:8:1: */
        if x[0] < x[1] {
                if x[2]&x[3] < 0 {
                        panic(fmt.Errorf("%v & %v = %v, < 0 ? %v", x[2], x[3], x[2]&x[3], x[2]&x[3] < 0))
                }
        }
}
jnml@pi32:~$ go run main.go
panic: 2 & 4 = 0, < 0 ? false

goroutine 1 [running]:
main.main()
        /home/jnml/main.go:10 +0x138
exit status 2
jnml@pi32:~$

Additional info: Same code does not fail on linux/386.

-j


Meng Zhuo

unread,
Nov 26, 2020, 9:13:53 PM11/26/20
to golang-dev

I can reproduce this on qemu go1.13
GOARCH=arm go run main.go
panic: 2 & 4 = 0, < 0 ? false

goroutine 1 [running]:
main.main()
        /root/main.go:9 +0x138
exit status 2

go version
go version go1.13.1 linux/arm64

Jason A. Donenfeld

unread,
Nov 29, 2020, 4:08:36 PM11/29/20
to golang-dev
Reply all
Reply to author
Forward
0 new messages