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 prove #26043

Closed
ALTree opened this issue Jun 25, 2018 · 2 comments
Closed

cmd/compile: internal compiler error: panic during prove #26043

ALTree opened this issue Jun 25, 2018 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Jun 25, 2018

$ gotip version
go version devel +6fdbed0543 Mon Jun 25 02:22:05 2018 +0000 linux/amd64

The following program:

package p

func f() {
	var s1 string
	var b bool
	if b {
		b = !b
		s1 += "a"
	}

	var s2 string
	var i, j int
	if (s1 <= "") || (s2 >= "") {
		j = len(s1[:6])
	} else {
		i = len("b")
	}

	for j < 0 {
		j += i
	}
}

crashes the tip compiler with an integer divide by zero error:

$ gotip build crash.go 

crash.go:6:2: internal compiler error: panic during prove while compiling f:

runtime error: integer divide by zero

goroutine 1 [running]:
cmd/compile/internal/ssa.Compile.func1(0xc00034ea68, 0xc0003422c0)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/compile.go:38 +0xc6
panic(0xc4bbc0, 0x12fd7b0)
	/home/adonizetti/go/src/runtime/panic.go:494 +0x1b9
cmd/compile/internal/ssa.findIndVar(0xc0003422c0, 0xc00038ae60, 0xc000354a10, 0xc000354930)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/loopbce.go:158 +0x8af
cmd/compile/internal/ssa.prove(0xc0003422c0)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/prove.go:765 +0x7ad
cmd/compile/internal/ssa.Compile(0xc0003422c0)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/compile.go:70 +0x30e
cmd/compile/internal/gc.buildssa(0xc000342000, 0x0, 0x0)
	/home/adonizetti/go/src/cmd/compile/internal/gc/ssa.go:211 +0xaa7
cmd/compile/internal/gc.compileSSA(0xc000342000, 0x0)
	/home/adonizetti/go/src/cmd/compile/internal/gc/pgen.go:259 +0x39
cmd/compile/internal/gc.compile(0xc000342000)
	/home/adonizetti/go/src/cmd/compile/internal/gc/pgen.go:238 +0x1a0
cmd/compile/internal/gc.funccompile(0xc000342000)
	/home/adonizetti/go/src/cmd/compile/internal/gc/pgen.go:209 +0xbd
cmd/compile/internal/gc.Main(0xccda88)
	/home/adonizetti/go/src/cmd/compile/internal/gc/main.go:637 +0x261d
main.main()
	/home/adonizetti/go/src/cmd/compile/main.go:51 +0x96

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/home/adonizetti/go/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xcc4f68, 0x2c, 0xc00031f280, 0x4, 0x4)
	/home/adonizetti/go/src/cmd/compile/internal/gc/subr.go:182 +0x1f7
cmd/compile/internal/gc.(*ssafn).Fatalf(0xc000063a10, 0x602100000002, 0xcc4f68, 0x2c, 0xc00031f280, 0x4, 0x4)
	/home/adonizetti/go/src/cmd/compile/internal/gc/ssa.go:5583 +0x67
cmd/compile/internal/ssa.(*Func).Fatalf(0xc0003422c0, 0xcc4f68, 0x2c, 0xc00031f280, 0x4, 0x4)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/func.go:562 +0x73
cmd/compile/internal/ssa.Compile.func1(0xc00034ea68, 0xc0003422c0)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/compile.go:40 +0x23a
panic(0xc4bbc0, 0x12fd7b0)
	/home/adonizetti/go/src/runtime/panic.go:494 +0x1b9
cmd/compile/internal/ssa.findIndVar(0xc0003422c0, 0xc00038ae60, 0xc000354a10, 0xc000354930)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/loopbce.go:158 +0x8af
cmd/compile/internal/ssa.prove(0xc0003422c0)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/prove.go:765 +0x7ad
cmd/compile/internal/ssa.Compile(0xc0003422c0)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/compile.go:70 +0x30e
cmd/compile/internal/gc.buildssa(0xc000342000, 0x0, 0x0)
	/home/adonizetti/go/src/cmd/compile/internal/gc/ssa.go:211 +0xaa7
cmd/compile/internal/gc.compileSSA(0xc000342000, 0x0)
	/home/adonizetti/go/src/cmd/compile/internal/gc/pgen.go:259 +0x39
cmd/compile/internal/gc.compile(0xc000342000)
	/home/adonizetti/go/src/cmd/compile/internal/gc/pgen.go:238 +0x1a0
cmd/compile/internal/gc.funccompile(0xc000342000)
	/home/adonizetti/go/src/cmd/compile/internal/gc/pgen.go:209 +0xbd
cmd/compile/internal/gc.Main(0xccda88)
	/home/adonizetti/go/src/cmd/compile/internal/gc/main.go:637 +0x261d
main.main()
	/home/adonizetti/go/src/cmd/compile/main.go:51 +0x96

The program compiles fine on go1.10.

@ALTree ALTree added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Jun 25, 2018
@ALTree ALTree added this to the Go1.11 milestone Jun 25, 2018
@ALTree
Copy link
Member Author

ALTree commented Jun 25, 2018

git bisect points to 6d379ad (cmd/compile: in prove, detect loops with negative increments) as the first bad commit.

cc @rasky @dr2chase

@gopherbot
Copy link

Change https://golang.org/cl/120759 mentions this issue: cmd/compile: avoid remainder in loopbce when increment=0

@golang golang locked and limited conversation to collaborators Jun 25, 2019
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. release-blocker
Projects
None yet
Development

No branches or pull requests

2 participants