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: Value live at entry. It shouldn't be. #19610

Closed
joneskoo opened this issue Mar 19, 2017 · 7 comments

Comments

Projects
None yet
6 participants
@joneskoo
Copy link
Contributor

commented Mar 19, 2017

internal compiler error: Value live at entry. It shouldn't be. func (*colorizer).Write, node line, value v81

I got this error in VS Code and here I've minimized it somewhat.

I'm using go version go1.8 darwin/amd64 but this problem can be reproduced at play.golang.org.

https://play.golang.org/p/kN2xSXSzH5

If you run it, you get:

tmp/sandbox374087104/main.go:26: internal compiler error: Value live at entry. It shouldn't be. func (*colorizer).Write, node line, value v81

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/usr/local/go/src/runtime/debug/stack.go:24 +0x79
cmd/compile/internal/gc.Fatalf(0xacd433, 0x40, 0xc4204071a0, 0x3, 0x3)
	/usr/local/go/src/cmd/compile/internal/gc/subr.go:167 +0x226
cmd/compile/internal/gc.(*ssaExport).Fatalf(0xdcb195, 0x1a, 0xacd433, 0x40, 0xc4204071a0, 0x3, 0x3)
	/usr/local/go/src/cmd/compile/internal/gc/ssa.go:4979 +0x5d
cmd/compile/internal/ssa.(*Config).Fatalf(0xc4203ae000, 0xc40000001a, 0xacd433, 0x40, 0xc4204071a0, 0x3, 0x3)
	/usr/local/go/src/cmd/compile/internal/ssa/config.go:343 +0x6e
cmd/compile/internal/gc.(*state).Fatalf(0xc42031e4b0, 0xacd433, 0x40, 0xc4204071a0, 0x3, 0x3)
	/usr/local/go/src/cmd/compile/internal/gc/ssa.go:286 +0x83
cmd/compile/internal/gc.(*simplePhiState).insertPhis(0xc4203a74b0)
	/usr/local/go/src/cmd/compile/internal/gc/phi.go:458 +0x2c5
cmd/compile/internal/gc.(*state).insertPhis(0xc42031e4b0)
	/usr/local/go/src/cmd/compile/internal/gc/phi.go:33 +0x172
cmd/compile/internal/gc.buildssa(0xc420397e60, 0x0)
	/usr/local/go/src/cmd/compile/internal/gc/ssa.go:174 +0x8ee
cmd/compile/internal/gc.compile(0xc420397e60)
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:362 +0x204
cmd/compile/internal/gc.funccompile(0xc420397e60)
	/usr/local/go/src/cmd/compile/internal/gc/dcl.go:1292 +0xdc
cmd/compile/internal/gc.Main()
	/usr/local/go/src/cmd/compile/internal/gc/main.go:464 +0x1f08
main.main()
	/usr/local/go/src/cmd/compile/main.go:50 +0xfe

I think this looks like an internal error that shouldn't be due to my incorrect code (which may or may not have been the original trigger).

@joneskoo joneskoo changed the title cmd/compile: internal compiler error: Value live at entry. cmd/compile: internal compiler error: Value live at entry. It shouldn't be. Mar 19, 2017

@joneskoo

This comment has been minimized.

Copy link
Contributor Author

commented Mar 19, 2017

@ALTree

This comment has been minimized.

Copy link
Member

commented Mar 19, 2017

Thanks for the report.

This issue is still present at tip, and it was introduced in CL 27203 (cmd/compile/internal/gc: enable new parser by default).

cc @mdempsky @griesemer

@joneskoo

This comment has been minimized.

Copy link
Contributor Author

commented Mar 19, 2017

Looking at the language spec, https://golang.org/ref/spec#ForClause I think this is an error because

The init statement may be a short variable declaration, but the post statement must not.

So it should raise an error about bad syntax, not internal error.

@ALTree ALTree added the NeedsFix label Mar 19, 2017

@go101

This comment has been minimized.

Copy link

commented Mar 19, 2017

btw, why define PostStmt as SimpleStmt https://golang.org/ref/spec#PostStmt

PostStmt = SimpleStmt .

instead of

PostStmt = EmptyStmt | ExpressionStmt | SendStmt | IncDecStmt | Assignment .

?

@josharian josharian added this to the Go1.9 milestone Mar 19, 2017

@griesemer griesemer self-assigned this Mar 20, 2017

@griesemer

This comment has been minimized.

Copy link
Contributor

commented Mar 20, 2017

@golang101 Because it's easier to see that similarities between Init and Post statements than if the one difference was emphasized in the grammar explicitly.

@griesemer

This comment has been minimized.

Copy link
Contributor

commented Mar 20, 2017

@ALTree Thanks for tracking this down. It appears that I missed an extra test that was present in the old code:

if post != nil && post.Colas {
        yyerror("cannot declare in the for-increment")
}

Fix forthcoming.

@gopherbot

This comment has been minimized.

Copy link

commented Mar 20, 2017

CL https://golang.org/cl/38375 mentions this issue.

@gopherbot gopherbot closed this in 422c7fe Mar 20, 2017

@golang golang locked and limited conversation to collaborators Mar 20, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.