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

gccgoimporter: crash on package with map alias #31540

Closed
thanm opened this issue Apr 18, 2019 · 4 comments
Closed

gccgoimporter: crash on package with map alias #31540

thanm opened this issue Apr 18, 2019 · 4 comments
Milestone

Comments

@thanm
Copy link
Contributor

thanm commented Apr 18, 2019

What version of Go are you using (go version)?

Using Go tip:

$ go version
go version devel +f448c212a1 Fri Apr 12 13:48:56 2019 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Linux amd64

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPROXY=""
GORACE=""
GOTMPDIR=""
...

What did you do?

Compile this package with gccgo:

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

Then import using gccgoimporter.

What did you expect to see?

Successful import.

What did you see instead?

Panic in parseField:

panic(0x5a7ec0, 0xc000011640)
	/ssd2/go/src/runtime/panic.go:619 +0x1b2
go/internal/gccgoimporter.(*parser).error(0xc0001069c0, 0x587400, 0x601720)
	/ssd2/go/src/go/internal/gccgoimporter/parser.go:87 +0x298
go/internal/gccgoimporter.(*parser).parseField(0xc0001069c0, 0xc000123360, 0xc000278e08, 0x1, 0x1)
	/ssd2/go/src/go/internal/gccgoimporter/parser.go:252 +0x292
go/internal/gccgoimporter.(*parser).parseStructType(0xc0001069c0, 0xc000123360, 0xc0002a6928, 0x1, 0x1, 0x0, 0xc0002a6928)
	/ssd2/go/src/go/internal/gccgoimporter/parser.go:674 +0x297
go/internal/gccgoimporter.(*parser).parseTypeSpec(0xc0001069c0, 0xc000123360, 0xc0002a6928, 0x1, 0x1, 0xc0002a6928, 0x0)
	/ssd2/go/src/go/internal/gccgoimporter/parser.go:817 +0x393
go/internal/gccgoimporter.(*parser).parseSavedType(0xc0001069c0, 0xc000123360, 0x333, 0x0, 0x0, 0x0)
	/ssd2/go/src/go/internal/gccgoimporter/parser.go:1041 +0x463
go/internal/gccgoimporter.(*parser).parseTypeAfterAngle(0xc0001069c0, 0xc000123360, 0x0, 0x0, 0x0, 0xc, 0xc0002a68f1)
	/ssd2/go/src/go/internal/gccgoimporter/parser.go:906 +0x5e6
go/internal/gccgoimporter.(*parser).parseType(0xc0001069c0, 0xc000123360, 0x0, 0x0, 0x0, 0x1, 0xc0002790d0)
	/ssd2/go/src/go/internal/gccgoimporter/parser.go:894 +0x69
go/internal/gccgoimporter.(*parser).parseNamedType(0xc0001069c0, 0xc0002a68e8, 0x1, 0x1, 0x750008, 0x0)

It looks as though the code for handling anonymous fields is not expecting to see an anon field that is an alias to a map type.

@gopherbot gopherbot added this to the Gccgo milestone Apr 18, 2019
@thanm thanm self-assigned this Apr 18, 2019
@gopherbot
Copy link

Change https://golang.org/cl/172603 mentions this issue: go/internal/gccgoimporter: improve alias handling for anonymous fields

@gopherbot
Copy link

Change https://golang.org/cl/173037 mentions this issue: go/internal/gccgoimporter: update package to match std lib version

gopherbot pushed a commit to golang/tools that referenced this issue Apr 20, 2019
Import changes from std lib version, specifically

  https://golang.org/cl/172603
  https://golang.org/cl/165739

which contain to a fix for reading of import data as
well as a couple of new test cases.

Updates golang/go#31540.

Change-Id: Iecb1a5a5a7bf100b2ebb871196868e96b1a50611
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173037
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/173440 mentions this issue: go/internal/gccgoimporter: revise previous anonymous field fix.

gopherbot pushed a commit that referenced this issue Apr 24, 2019
Revise the fix for #31540 to take into account the possibility that we
may see an alias to a name that has already been installed into
package scope. This scenario is not possible to reproduce with the
current importer unit tests; changes to the harness to enable this
scenario will be added in a later CL.

Updates #31540.

Change-Id: Ie155d5e0b998604177a78471cba2413f57d40229
Reviewed-on: https://go-review.googlesource.com/c/go/+/173440
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/173777 mentions this issue: go/internal/gccgoimporter: update package to match std lib version

gopherbot pushed a commit to golang/tools that referenced this issue Apr 25, 2019
Import changes from std lib version, specifically

      https://golang.org/cl/173440

which rolls out a more robust fix for issue 31540.

Updates golang/go#31540.

Change-Id: Ibeeb00ffd0ee6456d50fd4a243a1162f3940ad68
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173777
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@golang golang locked and limited conversation to collaborators Apr 23, 2020
@rsc rsc unassigned thanm Jun 23, 2022
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