cmd/compile: internal compiler error: panic during prove
Closed this issue · 4 comments
ALTree commented
$ gotip version
go version devel go1.24-760b722c Fri Aug 9 14:54:31 2024 +0000 linux/amd64
package p
var v []func()
func f(i int) {
v = make([]func(), -2|i)
}
$ gotip build crash.go
# command-line-arguments
./crash.go:7:1: internal compiler error: 'f': panic during prove while compiling f:
runtime error: invalid memory address or nil pointer dereference
goroutine 9 [running]:
cmd/compile/internal/ssa.Compile.func1()
./desktop/gotip/src/cmd/compile/internal/ssa/compile.go:49 +0x6c
panic({0xdacd40?, 0x14e8b40?})
./desktop/gotip/src/runtime/panic.go:785 +0x132
cmd/compile/internal/ssa.removeBranch(0x0, 0x0)
./desktop/gotip/src/cmd/compile/internal/ssa/prove.go:2160 +0x22
...
ALTree commented
cc @randall77
gabyhelp commented
Related Issues and Documentation
- cmd/compile: internal compiler error: panic during lower (part 2) #30257 (closed)
- cmd/compile: panic: internal error: can't locate after prolog value (with -N -l) #45948 (closed)
- cmd/compile: internal compiler error: panic during expand calls [on ARM and other 32bit archs] #63462 (closed)
- cmd/compile: internal compiler error: panic during layout #23504 (closed)
- cmd/compile: internal compiler error: panic: runtime error when clearing empty struct slice #61127 (closed)
- cmd/compile: internal compiler error: panic: builtins.go: assertion failed #61486 (closed)
- cmd/compile: internal compiler error: panic during prove #26043 (closed)
- cmd/compile: internal compiler error: panic during short circuit #45947 (closed)
- cmd/compile: panic: runtime error: invalid memory address or nil pointer dereference [dev.regabi] #43701 (closed)
- cmd/compile: internal compiler error: aliasing constant which is not registered #35157 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
randall77 commented
The reason it is panicking is because prove thinks the first block of the function is unreachable. I think there is some confusion lurking here between "unreachable" and "unconditionally panics" (the first block of f
is the latter, but it isn't the former).
This is maybe a better example:
package p
var v []func()
func f(i, j int) {
if j > 0 {
v = make([]func(), -2|i)
}
}
This function currently compiles to just RET
. It should compile to something that will panic if j>0.
gopherbot commented
Change https://go.dev/cl/604118 mentions this issue: cmd/compile: in prove pass, check for unsat before adding local facts