cmd/compile: "illegal combination SRA ADDCON REG REG" on mips
ALTree opened this issue · 2 comments
ALTree commented
$ go version
go version go1.15.5 linux/amd64
$ gotip version
go version devel +f423d616b1 Fri Nov 13 15:15:15 2020 +0000 linux/amd64
The following program:
package p
func f() {
var i, j int
_ = func() {
i = 32
j = j>>i | len([]int{})
}
}
Crashes the go1.15.5 and tip compilers when built for mips
:
$ GOARCH=mips go tool compile crash.go
00020 (crash.go:7) SRA $-1, R2, R2
00020 (crash.go:7) SRA $-1, R2, R2
00020 (crash.go:7) SRA $-1, R2, R2
00020 (crash.go:7) SRA $-1, R2, R2
crash.go:7:5: illegal combination SRA ADDCON REG REG
The go1.14.12 compiler compiles it with no issues.
gopherbot commented
Change https://golang.org/cl/270117 mentions this issue: cmd/compile: check unsigned value for SRA mips rule
gopherbot commented
Change https://golang.org/cl/270558 mentions this issue: cmd/compile: stop MOVW-ing -1 as SRA shift amount in mips