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: panic when parsing go code with invalid syntax #18092

Closed
kardianos opened this issue Nov 29, 2016 · 3 comments
Closed

cmd/compile: panic when parsing go code with invalid syntax #18092

kardianos opened this issue Nov 29, 2016 · 3 comments
Milestone

Comments

@kardianos
Copy link
Contributor

On go 8a2c34e
linux amd64

try to parse

package pkg

import "context"

func panicOnParse() {
	ctx := context.Background()
	select {
	default:
	case <-ctx.Done() {
	}
}

cmd go build

prints

panic: unimplemented [recovered]
	panic: unimplemented

goroutine 1 [running]:
cmd/compile/internal/syntax.Parse.func1(0xc4202f7a88)
	/home/daniel/code/go-cl/src/cmd/compile/internal/syntax/syntax.go:61 +0x10f
panic(0xa45360, 0xc4200154e0)
	/home/daniel/code/go-cl/src/runtime/panic.go:489 +0x2cf
cmd/compile/internal/syntax.(*parser).commClause(0xc420024c00, 0x0)
	/home/daniel/code/go-cl/src/cmd/compile/internal/syntax/parser.go:1825 +0x282
cmd/compile/internal/syntax.(*parser).selectStmt(0xc420024c00, 0x0)
	/home/daniel/code/go-cl/src/cmd/compile/internal/syntax/parser.go:1764 +0xc8
cmd/compile/internal/syntax.(*parser).stmt(0xc420024c00, 0x0, 0x0)
	/home/daniel/code/go-cl/src/cmd/compile/internal/syntax/parser.go:1904 +0x65d
cmd/compile/internal/syntax.(*parser).stmtList(0xc420024c00, 0xc4200154d0, 0x1, 0x1)
	/home/daniel/code/go-cl/src/cmd/compile/internal/syntax/parser.go:1973 +0x99
cmd/compile/internal/syntax.(*parser).funcBody(0xc420024c00, 0x0, 0x0, 0x0)
	/home/daniel/code/go-cl/src/cmd/compile/internal/syntax/parser.go:1109 +0x81
cmd/compile/internal/syntax.(*parser).funcDecl(0xc420024c00, 0x0)
	/home/daniel/code/go-cl/src/cmd/compile/internal/syntax/parser.go:430 +0x11e
cmd/compile/internal/syntax.(*parser).file(0xc420024c00, 0x0)
	/home/daniel/code/go-cl/src/cmd/compile/internal/syntax/parser.go:226 +0x3b6
cmd/compile/internal/syntax.Parse(0xd371a0, 0xc42000c530, 0xc420015460, 0xc420015470, 0x0, 0x0, 0xd37420, 0xc420310740)
	/home/daniel/code/go-cl/src/cmd/compile/internal/syntax/syntax.go:68 +0xd6
cmd/compile/internal/gc.parseFile(0x7ffdf795c105, 0x23)
	/home/daniel/code/go-cl/src/cmd/compile/internal/gc/noder.go:26 +0x1dd
cmd/compile/internal/gc.Main()
	/home/daniel/code/go-cl/src/cmd/compile/internal/gc/main.go:311 +0x13fb
main.main()
	/home/daniel/code/go-cl/src/cmd/compile/main.go:50 +0xfe

@bradfitz bradfitz added this to the Go1.8 milestone Nov 29, 2016
@bradfitz
Copy link
Contributor

And /cc @mdempsky

@griesemer
Copy link
Contributor

on it

@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators Nov 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants