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

x/tools/go/ssa: builder crash in map[*S]bool{{}: true} #13341

Closed
alandonovan opened this issue Nov 20, 2015 · 1 comment
Closed

x/tools/go/ssa: builder crash in map[*S]bool{{}: true} #13341

alandonovan opened this issue Nov 20, 2015 · 1 comment

Comments

@alandonovan
Copy link
Contributor

% cat a.go
package p

type S struct{}

var _ = map[*S]bool{{}: true}

% ssadump -build=FSL a.go
build package p
build global initializer [var _ map[*p.S]bool] @ a.go:5:9
build package p end
panic: in p.init: cannot convert *t0 (p.S) to *p.S

goroutine 1 [running]:
golang.org/x/tools/go/ssa.emitConv(0xc8200e6000, 0x7f481dde8920, 0xc8200ce360, 0x7f481dde84a8, 0xc8200be280, 0x0, 0x0)
golang.org/x/tools/go/ssa/emit.go:243 +0xc6d
golang.org/x/tools/go/ssa.(_builder).compLit(0xc8200e3627, 0xc8200e6000, 0x7f481dde8c80, 0xc8200ce2a0, 0xc8200ba280, 0xc8200d0601, 0xc8200e2bf8)
golang.org/x/tools/go/ssa/builder.go:1199 +0x1d96
golang.org/x/tools/go/ssa.(_builder).addr(0xc8200e3627, 0xc8200e6000, 0x7f481dde8270, 0xc8200ba280, 0x78a000, 0x0, 0x0)
golang.org/x/tools/go/ssa/builder.go:361 +0x67f
golang.org/x/tools/go/ssa.(_builder).expr0(0xc8200e3627, 0xc8200e6000, 0x7f481dde8270, 0xc8200ba280, 0x411107, 0x7f481dde8478, 0xc8200c4260, 0x0, 0x0, 0x0, ...)
golang.org/x/tools/go/ssa/builder.go:782 +0x772
golang.org/x/tools/go/ssa.(_builder).expr(0xc8200e3627, 0xc8200e6000, 0x7f481dde8270, 0xc8200ba280, 0x0, 0x0)
golang.org/x/tools/go/ssa/builder.go:531 +0x3b8
golang.org/x/tools/go/ssa.(_builder).assign(0xc8200e3627, 0xc8200e6000, 0x7f481dde8bf0, 0x97d1c8, 0x7f481dde8270, 0xc8200ba280, 0x97d101, 0x0)
golang.org/x/tools/go/ssa/builder.go:503 +0x442
golang.org/x/tools/go/ssa.(_Package).build(0xc8200ce120)
golang.org/x/tools/go/ssa/builder.go:2310 +0x133c
golang.org/x/tools/go/ssa.(_Package).(golang.org/x/tools/go/ssa.build)-fm()
golang.org/x/tools/go/ssa/builder.go:2244 +0x20
sync.(_Once).Do(0xc8200ce14c, 0xc8200e3b38)
/usr/local/google/home/adonovan/go/src/sync/once.go:44 +0xe4
golang.org/x/tools/go/ssa.(*Package).Build(0xc8200ce120)
golang.org/x/tools/go/ssa/builder.go:2244 +0x45
main.doMain(0x0, 0x0)
golang.org/x/tools/cmd/ssadump/main.go:145 +0x965
main.main()
golang.org/x/tools/cmd/ssadump/main.go:71 +0x24

@alandonovan alandonovan self-assigned this Nov 20, 2015
@adonovan
Copy link
Member

commit 977844c
Author: Alan Donovan adonovan@google.com
Date: Fri Nov 20 15:08:07 2015 -0500

go/ssa: fix crash when building map[*struct{}]bool{{}: true}

Since Go 1.5, if a key expression in a map literal is itself a composite
literal, the type may be omitted.  An & operation may be implied,
but was not generated, resulting in a type mismatch crash.

Added regression test.
Also, added missing intrinsic math.hasSSE4 to interpreter.

Fixes issue 13341

Change-Id: I6a5e560460cdcac295a500a3fc3738cbe8aa5853
Reviewed-on: https://go-review.googlesource.com/17123
Reviewed-by: Robert Griesemer <gri@golang.org>

@golang golang locked and limited conversation to collaborators Dec 29, 2016
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

3 participants