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: regression in handling of struct literals #18994

Closed
dsnet opened this issue Feb 8, 2017 · 1 comment
Closed

cmd/compile: regression in handling of struct literals #18994

dsnet opened this issue Feb 8, 2017 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dsnet
Copy link
Member

dsnet commented Feb 8, 2017

a833485 caused a regression in the handling of struct literals.

Consider the following program:

package main
import "crypto/x509"
func main() {
	_ = [][]byte{x509.Certificate{}.Raw}
}

Compiling it fails:

./fail_test.go:9: internal compiler error: unhandled addr STRUCTLIT

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/home/rawr/Projects/go/src/runtime/debug/stack.go:24 +0x79
cmd/compile/internal/gc.Fatalf(0xab8b05, 0x11, 0xc42037bc70, 0x1, 0x1)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/subr.go:175 +0x230
cmd/compile/internal/gc.(*ssaExport).Fatalf(0xdc1015, 0x92400000001, 0xab8b05, 0x11, 0xc42037bc70, 0x1, 0x1)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:4960 +0x67
cmd/compile/internal/ssa.(*Config).Fatalf(0xc420564000, 0x92400000001, 0xab8b05, 0x11, 0xc42037bc70, 0x1, 0x1)
	/home/rawr/Projects/go/src/cmd/compile/internal/ssa/config.go:345 +0x76
cmd/compile/internal/gc.(*state).Fatalf(0xc42000e600, 0xab8b05, 0x11, 0xc42037bc70, 0x1, 0x1)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:287 +0x8e
cmd/compile/internal/gc.(*state).addr(0xc42000e600, 0xc42055e5a0, 0xc42046c000, 0x0, 0x7f83c4299000)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:3166 +0xc48
cmd/compile/internal/gc.(*state).addr(0xc42000e600, 0xc42055e500, 0xc42000e600, 0x0, 0x0)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:3143 +0xda6
cmd/compile/internal/gc.(*state).expr(0xc42000e600, 0xc42055e500, 0x0)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:1959 +0x37dc
cmd/compile/internal/gc.(*state).stmt(0xc42000e600, 0xc42055e960)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:719 +0x1d9
cmd/compile/internal/gc.(*state).stmtList(0xc42000e600, 0xc420551040)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:492 +0x5a
cmd/compile/internal/gc.(*state).stmt(0xc42000e600, 0xc42055eb40)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:515 +0x1281
cmd/compile/internal/gc.(*state).stmtList(0xc42000e600, 0xc4205510e0)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:492 +0x5a
cmd/compile/internal/gc.(*state).stmt(0xc42000e600, 0xc42055e3c0)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:511 +0xb5
cmd/compile/internal/gc.(*state).stmtList(0xc42000e600, 0xc420550fa0)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:492 +0x5a
cmd/compile/internal/gc.buildssa(0xc4200b4140, 0x0)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/ssa.go:140 +0xd5e
cmd/compile/internal/gc.compile(0xc4200b4140)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/pgen.go:365 +0x2d3
cmd/compile/internal/gc.funccompile(0xc4200b4140)
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/dcl.go:1226 +0xdc
cmd/compile/internal/gc.Main()
	/home/rawr/Projects/go/src/cmd/compile/internal/gc/main.go:473 +0x204c
main.main()
	/home/rawr/Projects/go/src/cmd/compile/main.go:50 +0xfe

This compiled properly on prior versions of Go.

\cc @mdempsky @cherrymui

@dsnet dsnet added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 8, 2017
@dsnet dsnet added this to the Go1.9 milestone Feb 8, 2017
@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators Feb 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants