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

Closed
dsnet opened this issue May 11, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@dsnet
Copy link
Member

commented May 11, 2017

Commit dfeecda from https://golang.org/cl/42175 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
cmd/compile/internal/gc.dowidth(0xc42032e780)
	/usr/local/go.tip/src/cmd/compile/internal/gc/align.go:372 +0x304
cmd/compile/internal/gc.checkwidth(0xc42032e780)
	/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
cmd/compile/internal/gc.Main(0xb8f390)
	/usr/local/go.tip/src/cmd/compile/internal/gc/main.go:473 +0x1f22
main.main()
	/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

@josharian

This comment has been minimized.

Copy link
Contributor

commented May 11, 2017

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

@gopherbot

This comment has been minimized.

Copy link

commented May 11, 2017

CL https://golang.org/cl/43290 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.