Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: "illegal combination SRA ADDCON REG REG" on mips #42587

Closed
ALTree opened this issue Nov 13, 2020 · 2 comments
Closed

cmd/compile: "illegal combination SRA ADDCON REG REG" on mips #42587

ALTree opened this issue Nov 13, 2020 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Nov 13, 2020

$ 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.

cc @cherrymui @randall77

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 13, 2020
@ALTree ALTree added this to the Go1.16 milestone Nov 13, 2020
@gopherbot
Copy link

Change https://golang.org/cl/270117 mentions this issue: cmd/compile: check unsigned value for SRA mips rule

@gopherbot
Copy link

Change https://golang.org/cl/270558 mentions this issue: cmd/compile: stop MOVW-ing -1 as SRA shift amount in mips

gopherbot pushed a commit that referenced this issue Nov 18, 2020
The shift amount in SRAconst needs to be in the [0,31] range, so stop
MOVWing -1 to SRA in the Rsh lowering rules.

Also see CL 270117.

Passes

  $ GOARCH=mips go build -toolexec 'toolstash -cmp' -a std
  $ GOARCH=mipsle go build -toolexec 'toolstash -cmp' -a std

Updates #42587

Change-Id: Ib5eb99b82310e404cc2d6f0c619b21b8a15406ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/270558
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
@golang golang locked and limited conversation to collaborators Nov 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants