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: internal compiler error: panic during lower (integer divide by zero) #43099

Closed
ALTree opened this issue Dec 9, 2020 · 1 comment
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 Dec 9, 2020

go version go1.14.13 linux/amd64
go version go1.15.6 linux/amd64
go version devel +854a2f8e01 Wed Dec 9 03:06:41 2020 +0000 linux/amd64

The following program:

package p

func f() {
	var i int
	var s string
	for i > 0 {
		_ = s[0]
		i++
	}

	var c chan int
	c <- 1 % i
}

Crashes the 1.14, 1.15, and tip compilers, when compiled for arm, mips, or mipsle, with this error:

$ GOARCH=arm go tool compile crash.go

crash.go:6:10: internal compiler error: 'f': panic during lower while compiling f:

runtime error: integer divide by zero

goroutine 1 [running]:
cmd/compile/internal/ssa.Compile.func1(0xc00045c550, 0xc0001506e0)
	/home/alberto/go/src/cmd/compile/internal/ssa/compile.go:48 +0xa5
panic(0xc34f20, 0x11182c0)
	/home/alberto/go/src/runtime/panic.go:965 +0x1b9
cmd/compile/internal/ssa.rewriteValueARM_OpSelect1(0xc000400a10, 0xc000400400)
	/home/alberto/go/src/cmd/compile/internal/ssa/rewriteARM.go:15681 +0x1f7
cmd/compile/internal/ssa.rewriteValueARM(0xc000400a10, 0xc000000000)
	/home/alberto/go/src/cmd/compile/internal/ssa/rewriteARM.go:807 +0x3e7d

[...]

Tentatively putting in the 1.16 milestone, pending investigation.

cc @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 Dec 9, 2020
@ALTree ALTree added this to the Go1.16 milestone Dec 9, 2020
@gopherbot
Copy link

Change https://golang.org/cl/276652 mentions this issue: cmd/compile: don't constant fold divide by zero

@golang golang deleted a comment Dec 9, 2020
@golang golang locked and limited conversation to collaborators Dec 10, 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