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 taking pointer of array literal #20333

dsnet opened this issue May 11, 2017 · 2 comments


None yet
3 participants
Copy link

commented May 11, 2017

Commit dfeecda from caused a regression that causes this code to now fail to compile:

package main
import "fmt"
func main() {
	fmt.Println(&[...]string{"abc", "def", "ghi"})

The compiler output is:

# command-line-arguments
./main.go:8:46: use of [...] array outside of array literal
./main.go:8:46: internal compiler error: invalid alignment for [...]string

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/usr/local/go.tip/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xb7ec95, 0x18, 0xc4203344d0, 0x1, 0x1)
	/usr/local/go.tip/src/cmd/compile/internal/gc/subr.go:181 +0x230
	/usr/local/go.tip/src/cmd/compile/internal/gc/align.go:372 +0x304
	/usr/local/go.tip/src/cmd/compile/internal/gc/align.go:424 +0x17c
cmd/compile/internal/gc.typecheck1(0xc4202f5400, 0x44, 0x0)
	/usr/local/go.tip/src/cmd/compile/internal/gc/typecheck.go:501 +0x7e36
cmd/compile/internal/gc.typecheck(0xc4202f5400, 0x44, 0x0)
	/usr/local/go.tip/src/cmd/compile/internal/gc/typecheck.go:201 +0x78a
cmd/compile/internal/gc.typecheckcomplit(0xc4202f5080, 0x0)
	/usr/local/go.tip/src/cmd/compile/internal/gc/typecheck.go:2926 +0x13e
cmd/compile/internal/gc.typecheck1(0xc4202f5080, 0x12, 0xc420322f00)
	/usr/local/go.tip/src/cmd/compile/internal/gc/typecheck.go:837 +0x579b
cmd/compile/internal/gc.typecheck(0xc4202f5080, 0x12, 0xc420322f00)
	/usr/local/go.tip/src/cmd/compile/internal/gc/typecheck.go:201 +0x78a
cmd/compile/internal/gc.typecheck1(0xc4202f5000, 0x1, 0x4b3aba)
	/usr/local/go.tip/src/cmd/compile/internal/gc/typecheck.go:1250 +0x4e32
cmd/compile/internal/gc.typecheck(0xc4202f5000, 0x1, 0x3)
	/usr/local/go.tip/src/cmd/compile/internal/gc/typecheck.go:201 +0x78a
cmd/compile/internal/gc.typecheckslice(0xc42000c738, 0x1, 0x1, 0x1)
	/usr/local/go.tip/src/cmd/compile/internal/gc/typecheck.go:55 +0x46
	/usr/local/go.tip/src/cmd/compile/internal/gc/main.go:473 +0x1f22
	/usr/local/go.tip/src/cmd/compile/main.go:49 +0x95

\cc @josharian

@dsnet dsnet added the NeedsFix label May 11, 2017

@dsnet dsnet added this to the Go1.9 milestone May 11, 2017


This comment has been minimized.

Copy link

commented May 11, 2017

Thanks as always, @dsnet! Fix is on its way.


This comment has been minimized.

Copy link

commented May 11, 2017

CL mentions this issue.

@gopherbot gopherbot closed this in dccc653 May 11, 2017

@golang golang locked and limited conversation to collaborators May 11, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.