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 while printing error when cross-compiling #20789

Closed
josharian opened this issue Jun 24, 2017 · 2 comments
Closed

cmd/compile: panic while printing error when cross-compiling #20789

josharian opened this issue Jun 24, 2017 · 2 comments

Comments

@josharian
Copy link
Contributor

package e
func([<-chan<-[func u){go

Running on darwin/amd64, with go1.9beta1:

$ GOOS=linux go tool compile x.go
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: interface conversion: interface {} is runtime.errorString, not syntax.localError [recovered]
	panic: interface conversion: interface {} is runtime.errorString, not syntax.localError
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x110763d]

goroutine 18 [running]:
cmd/compile/internal/syntax.Parse.func1(0xc420341f30)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/syntax.go:66 +0xfe
panic(0x17060e0, 0xc42030b0c0)
	/Users/josh/go/tip/src/runtime/panic.go:491 +0x283
cmd/compile/internal/syntax.Fprint.func1(0xc420341998, 0xc420341910, 0xc4203419a0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:28 +0xb0
panic(0x17052c0, 0x1a87150)
	/Users/josh/go/tip/src/runtime/panic.go:491 +0x283
cmd/compile/internal/syntax.(*printer).printRawNode(0xc420341910, 0x1a6ce20, 0x0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:405 +0x528d
cmd/compile/internal/syntax.(*printer).printNode(0xc420341910, 0x1a6ce20, 0x0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:327 +0x3f
cmd/compile/internal/syntax.(*printer).print(0xc420341910, 0xc42033e0a0, 0x3, 0x3)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:250 +0x60c
cmd/compile/internal/syntax.(*printer).printRawNode(0xc420341910, 0x1a6ce60, 0xc4203058a0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:517 +0x4f7c
cmd/compile/internal/syntax.(*printer).printNode(0xc4202f5910, 0x1a6ce60, 0xc4203058a0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:327 +0x3f
cmd/compile/internal/syntax.(*printer).print(0xc420341910, 0xc420305940, 0x2, 0x2)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:250 +0x60c
cmd/compile/internal/syntax.(*printer).printStmtList(0xc420341910, 0xc42007c930, 0x1, 0x1, 0x1)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:879 +0x105
cmd/compile/internal/syntax.(*printer).printRawNode(0xc420341910, 0x1a6cda0, 0xc42030b080)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:535 +0x1d95
cmd/compile/internal/syntax.(*printer).printNode(0xc4202f5910, 0x1a6cda0, 0xc42030b080)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:327 +0x3f
cmd/compile/internal/syntax.(*printer).print(0xc420341910, 0xc4203400b8, 0x3, 0x3)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:250 +0x60c
cmd/compile/internal/syntax.(*printer).printRawNode(0xc4202f5910, 0x1a6d1e0, 0xc420305880)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:358 +0x3e24
cmd/compile/internal/syntax.(*printer).printNode(0xc420045910, 0x1a6d1e0, 0xc420305880)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:327 +0x3f
cmd/compile/internal/syntax.(*printer).print(0xc420341910, 0xc420341538, 0x4, 0x4)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:250 +0x60c
cmd/compile/internal/syntax.(*printer).printRawNode(0xc420045910, 0x1a6cc60, 0xc42030e180)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:438 +0x472e
cmd/compile/internal/syntax.(*printer).printNode(0xc420045910, 0x1a6cc60, 0xc42030e180)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:327 +0x3f
cmd/compile/internal/syntax.(*printer).print(0xc420341910, 0xc420341900, 0x1, 0x1)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:250 +0x60c
cmd/compile/internal/syntax.Fprint(0x1a6a820, 0xc420338000, 0x1a6cc60, 0xc42030e180, 0x100d400, 0xc, 0x0, 0x0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:32 +0x13b
cmd/compile/internal/syntax.String(0x1a6cc60, 0xc42030e180, 0xc42030e180, 0x1a6cc60)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/printer.go:40 +0x64
cmd/compile/internal/syntax.(*parser).unaryExpr(0xc420330000, 0x1ad4e40, 0x1bcd6c8)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:615 +0x1d7
cmd/compile/internal/syntax.(*parser).binaryExpr(0xc420330000, 0x0, 0xc420046b01, 0xc42030e120)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:529 +0x2f
cmd/compile/internal/syntax.(*parser).expr(0xc420330000, 0x15, 0x0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:522 +0x34
cmd/compile/internal/syntax.(*parser).typeOrNil(0xc420330000, 0x30, 0x171d1a0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:1029 +0x44c
cmd/compile/internal/syntax.(*parser).type_(0xc420330000, 0xc42030e0f0, 0xc420021370)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:959 +0x2f
cmd/compile/internal/syntax.(*parser).paramDeclOrNil(0xc420330000, 0xb)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:1390 +0xbb
cmd/compile/internal/syntax.(*parser).paramList(0xc420330000, 0xc42030b000, 0xc420305820, 0xc42002cda0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:1436 +0x11e
cmd/compile/internal/syntax.(*parser).funcDeclOrNil(0xc420330000, 0x24)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:463 +0x252
cmd/compile/internal/syntax.(*parser).fileOrNil(0xc420330000, 0xc4200924b0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:289 +0x355
cmd/compile/internal/syntax.Parse(0xc4200924b0, 0x1a6aa20, 0xc4200904d0, 0xc42007c860, 0xc42007c870, 0x1, 0x0, 0x0, 0x0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/syntax.go:73 +0xf1
cmd/compile/internal/gc.parseFiles.func1(0xc42030af00, 0x7fff5fbff901, 0x4)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/noder.go:39 +0x2c5
created by cmd/compile/internal/gc.parseFiles
	/Users/josh/go/tip/src/cmd/compile/internal/gc/noder.go:28 +0x188

Does not reproduce with 1.8.

Marking Go 1.9Maybe, because it is a regression, but possibly a low priority one.

cc @mdempsky @griesemer

Found with go-fuzz (cc @dvyukov).

@josharian josharian added this to the Go1.9Maybe milestone Jun 24, 2017
@gopherbot
Copy link

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

gopherbot pushed a commit that referenced this issue Jun 27, 2017
Updates #20789

Change-Id: Ic7a94394e283bc1b667cdad999ceee9513f35e37
Reviewed-on: https://go-review.googlesource.com/46770
Reviewed-by: Robert Griesemer <gri@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/88336 mentions this issue: cmd/compile/internal/syntax: added test cases for recent fixes

gopherbot pushed a commit that referenced this issue Feb 12, 2018
R=go1.11.

Now that we have a syntax error test harness, we can add the
proper tests for the recent parser fixes.

For #20800.
For #20789.
For #23385.
For #23434.

A test for #20789 already exists in test/fixedbugs, but this
is the better location for that test. But leaving the existing
one where it is as well.

Change-Id: I5937b9b63bafd1efab467a00344302e717976171
Reviewed-on: https://go-review.googlesource.com/88336
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@golang golang locked and limited conversation to collaborators Jan 19, 2019
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

2 participants