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: invalid recursive array type crashes the compiler spuriously after emitting "invalid recursive type" error #21882

Closed
mlowicki opened this issue Sep 14, 2017 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mlowicki
Copy link
Contributor

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

go version go1.9 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mlowicki/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/85/p6r5ztv90bq4x5d3yl7r0x_m0000gn/T/go-build175496818=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

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

package main

type Node [2]Node

func main() {
}

What did you expect to see?

Something like in https://play.golang.org/p/VKwq0UFZmF so one error message:

./hello.go:3:6: invalid recursive type Node

What did you see instead?

./hello.go:3:6: invalid recursive type Node
./hello.go:3:6: internal compiler error: invalid alignment for Node

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
        /usr/local/Cellar/go/1.9/libexec/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0x176124e, 0x18, 0xc42031f790, 0x1, 0x1)
        /usr/local/Cellar/go/1.9/libexec/src/cmd/compile/internal/gc/subr.go:181 +0x230
cmd/compile/internal/gc.dowidth(0xc42030f860)
        /usr/local/Cellar/go/1.9/libexec/src/cmd/compile/internal/gc/align.go:372 +0x304
cmd/compile/internal/gc.resumecheckwidth()
        /usr/local/Cellar/go/1.9/libexec/src/cmd/compile/internal/gc/align.go:452 +0x54
cmd/compile/internal/gc.Main(0x17719f8)
        /usr/local/Cellar/go/1.9/libexec/src/cmd/compile/internal/gc/main.go:468 +0x1ec6
main.main()
        /usr/local/Cellar/go/1.9/libexec/src/cmd/compile/main.go:49 +0x95
@odeke-em odeke-em changed the title "invalid recursive type" is followed by "internal compiler error" for recursive array type cmd/compile: invalid recursive array type crashes the compiler spuriously after emitting "invalid recursive type" error Sep 14, 2017
@odeke-em
Copy link
Member

Bad news:
This issue is a regression, it didn't exist in Go1.8, but it now does on Go1.9 and tip.

Go1.8

screen shot 2017-09-14 at 2 44 32 pm

Tip

screen shot 2017-09-14 at 2 46 28 pm

Paging part of the compiler squad @mdempsky @griesemer.

@ianlancetaylor ianlancetaylor added this to the Go1.9.1 milestone Sep 15, 2017
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 15, 2017
@gopherbot
Copy link

Change https://golang.org/cl/64430 mentions this issue: cmd/compile: fix compiler crash on recursive types

@rsc rsc modified the milestones: Go1.9.1, Go1.9.2 Oct 4, 2017
@rsc rsc reopened this Oct 13, 2017
@ianlancetaylor
Copy link
Contributor

This is a crash-on-invalid. I don't think it's all that important to fix in 1.9.2.

@rsc
Copy link
Contributor

rsc commented Oct 13, 2017

Let's do #22252 for Go 1.9.2 instead. Lower risk, higher reward.

@rsc rsc modified the milestones: Go1.9.2, Go1.10 Oct 13, 2017
@rsc rsc closed this as completed Oct 13, 2017
@golang golang locked and limited conversation to collaborators Oct 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants