-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: assertion failure when building syntax package with gotypesalias enabled #66873
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
Comments
@adonovan for visibility |
The package object being compiled is |
Follo-up: With pending CL 579935 (which may eventually get submitted), to enable type alias nodes, set the new |
Change https://go.dev/cl/568455 mentions this issue: |
Simple reproducer: package p
func f(A) {}
type T int
type A = T
func (A) m() {} Compiling this package ( @mdempsky any insights? |
See also my investigation here: #65893 (comment) We should probably land CL https://go-review.googlesource.com/c/go/+/568455, so this is the only issue that track the problem. |
The type checker seems to be doing the right thing for the above program:
|
I think types2 is behaving correctly. The issue is we don't have proper alias types in compiler IR, so the importer can't rely on them to break cycles. We might have to do a two-phase initialization to ensure IR is constructed in the right order. Thinking about it. |
Change https://go.dev/cl/585399 mentions this issue: |
CL 579935 disabled usage of Alias types in the compiler, and tracks the problem with issue #66873. The test case in #65893 passes now with the current tip. This CL adds a test case to ensure there is no regression once Alias types are enabled for the compiler. Updates #66873 Fixes #65893 Change-Id: I51b51bb13ca59549bc5925dd95f73da40465556d Reviewed-on: https://go-review.googlesource.com/c/go/+/568455 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Change https://go.dev/cl/604099 mentions this issue: |
Flips the pkgReader.enableAlias flag to true when reading unified IR. This was disabled while resolving #66873. This resolves the TODO to flip it back to true. Updates #66873 Updates #68778 Change-Id: Ifd52b0f9510d6bcf151de1c9a18d71ab548c14e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/604099 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Change https://go.dev/cl/629997 mentions this issue: |
Change https://go.dev/cl/631855 mentions this issue: |
Flips the pkgReader.enableAlias flag to true when reading unified IR. This was disabled while resolving #66873. This resolves the TODO to flip it back to true. Fixes #70394 Fixes #70517 Updates #66873 Change-Id: Ifd52b0f9510d6bcf151de1c9a18d71ab548c14e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/604099 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> (cherry picked from commit 209ed1a) Reviewed-on: https://go-review.googlesource.com/c/go/+/631855 Commit-Queue: Tim King <taking@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Flips the pkgReader.enableAlias flag to true when reading unified IR. This was disabled while resolving golang#66873. This resolves the TODO to flip it back to true. Fixes golang#70394 Fixes golang#70517 Updates golang#66873 Change-Id: Ifd52b0f9510d6bcf151de1c9a18d71ab548c14e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/604099 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> (cherry picked from commit 209ed1a) Reviewed-on: https://go-review.googlesource.com/c/go/+/631855 Commit-Queue: Tim King <taking@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Flips the pkgReader.enableAlias flag to true when reading unified IR. This was disabled while resolving golang#66873. This resolves the TODO to flip it back to true. Fixes golang#70394 Fixes golang#70517 Updates golang#66873 Change-Id: Ifd52b0f9510d6bcf151de1c9a18d71ab548c14e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/604099 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> (cherry picked from commit 209ed1a) Reviewed-on: https://go-review.googlesource.com/c/go/+/631855 Commit-Queue: Tim King <taking@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Change https://go.dev/cl/668175 mentions this issue: |
To reproduce:
$ go build cmd/compile/internal/syntax
# cmd/compile/internal/syntax
cmd/compile/internal/syntax/tokens.go:7:6: internal compiler error: assertion failed
goroutine 1 [running]:
runtime/debug.Stack()
./runtime/debug/stack.go:26 +0x5e
cmd/compile/internal/base.FatalfAt({0x1853a40?, 0xc0?}, {0x69dcafc, 0x10}, {0x0, 0x0, 0x0})
cmd/compile/internal/base/print.go:225 +0x1d7
cmd/compile/internal/base.Fatalf(...)
cmd/compile/internal/base/print.go:194
cmd/compile/internal/base.Assert(...)
cmd/compile/internal/base/print.go:237
cmd/compile/internal/noder.assert(...)
cmd/compile/internal/noder/stencil.go:15
cmd/compile/internal/noder.(*pkgReader).typIdx(...)
cmd/compile/internal/noder/reader.go:430
cmd/compile/internal/noder.(*reader).typWrapped(0xc0018537c0, 0x1)
cmd/compile/internal/noder/reader.go:388 +0x156
cmd/compile/internal/noder.(*reader).typ(...)
cmd/compile/internal/noder/reader.go:382
cmd/compile/internal/noder.(*reader).param(0xc0018537c0)
cmd/compile/internal/noder/reader.go:622 +0x18d
cmd/compile/internal/noder.(*reader).method(0xc0018537c0, 0xc001853900)
cmd/compile/internal/noder/reader.go:1022 +0x7c
cmd/compile/internal/noder.(*pkgReader).objIdxMayFail(0xc000ad56c0, 0x25, {0x0, 0x0, 0x0}, {0x721b420, 0x0, 0x0}, 0x0)
cmd/compile/internal/noder/reader.go:816 +0xd76
cmd/compile/internal/noder.(*pkgReader).objIdx(...)
cmd/compile/internal/noder/reader.go:670
cmd/compile/internal/noder.(*pkgReader).objInstIdx(0xc000ad56c0, {0xffffffff?, {0x721b420?, 0xc000600008?, 0xc0018468f0?}}, 0xc0017f5790, 0x0)
cmd/compile/internal/noder/reader.go:662 +0x96
cmd/compile/internal/noder.(*reader).obj(0xc001853400)
cmd/compile/internal/noder/reader.go:634 +0x46
cmd/compile/internal/noder.(*reader).doTyp(0xc001853400)
cmd/compile/internal/noder/reader.go:500 +0x72
cmd/compile/internal/noder.(*pkgReader).typIdx(...)
cmd/compile/internal/noder/reader.go:429
cmd/compile/internal/noder.(*reader).typWrapped(0xc001853040, 0x1)
cmd/compile/internal/noder/reader.go:388 +0x125
cmd/compile/internal/noder.(*reader).typ(...)
cmd/compile/internal/noder/reader.go:382
cmd/compile/internal/noder.(*pkgReader).objIdxMayFail(0xc000ad56c0, 0x24, {0x0, 0x0, 0x0}, {0x721b420, 0x0, 0x0}, 0x0)
cmd/compile/internal/noder/reader.go:744 +0xca5
cmd/compile/internal/noder.(*pkgReader).objIdx(...)
cmd/compile/internal/noder/reader.go:670
cmd/compile/internal/noder.(*pkgReader).objInstIdx(0xc000ad56c0, {0xffffffff?, {0x721b420?, 0xc000ccea40?, 0x60c1056?}}, 0xc0017f56c0, 0x0)
cmd/compile/internal/noder/reader.go:662 +0x96
cmd/compile/internal/noder.(*reader).obj(0xc001852c80)
cmd/compile/internal/noder/reader.go:634 +0x46
cmd/compile/internal/noder.(*reader).doTyp(0xc001852c80)
cmd/compile/internal/noder/reader.go:500 +0x72
cmd/compile/internal/noder.(*pkgReader).typIdx(...)
cmd/compile/internal/noder/reader.go:429
cmd/compile/internal/noder.(*reader).typWrapped(0xc001852b40, 0x1)
cmd/compile/internal/noder/reader.go:388 +0x125
cmd/compile/internal/noder.(*reader).typ(...)
cmd/compile/internal/noder/reader.go:382
cmd/compile/internal/noder.(*reader).structType(0xc001852b40)
cmd/compile/internal/noder/reader.go:589 +0xad
cmd/compile/internal/noder.(*reader).doTyp(0xc001852b40)
cmd/compile/internal/noder/reader.go:522 +0x37f
cmd/compile/internal/noder.(*pkgReader).typIdx(...)
cmd/compile/internal/noder/reader.go:429
cmd/compile/internal/noder.(*reader).typWrapped(0xc0018528c0, 0x0)
cmd/compile/internal/noder/reader.go:388 +0x125
cmd/compile/internal/noder.(*pkgReader).objIdxMayFail(0xc000ad56c0, 0x23, {0x0, 0x0, 0x0}, {0x721b420, 0x0, 0x0}, 0x0)
cmd/compile/internal/noder/reader.go:805 +0x53c
cmd/compile/internal/noder.(*pkgReader).objIdx(...)
cmd/compile/internal/noder/reader.go:670
cmd/compile/internal/noder.(*pkgReader).objInstIdx(0xc000ad56c0, {0xffffffff?, {0x721b420?, 0x39300000005?, 0x0?}}, 0xc0017f4dd0, 0x0)
cmd/compile/internal/noder/reader.go:662 +0x96
cmd/compile/internal/noder.(*reader).obj(0xc001852500)
cmd/compile/internal/noder/reader.go:634 +0x46
cmd/compile/internal/noder.(*reader).doTyp(0xc001852500)
cmd/compile/internal/noder/reader.go:500 +0x72
cmd/compile/internal/noder.(*pkgReader).typIdx(...)
cmd/compile/internal/noder/reader.go:429
cmd/compile/internal/noder.(*reader).typWrapped(0xc0018523c0, 0x1)
cmd/compile/internal/noder/reader.go:388 +0x125
cmd/compile/internal/noder.(*reader).typ(...)
cmd/compile/internal/noder/reader.go:382
cmd/compile/internal/noder.(*reader).doTyp(0xc0018523c0)
cmd/compile/internal/noder/reader.go:516 +0xdb
cmd/compile/internal/noder.(*pkgReader).typIdx(...)
cmd/compile/internal/noder/reader.go:429
cmd/compile/internal/noder.(*reader).typWrapped(0xc001852280, 0x1)
cmd/compile/internal/noder/reader.go:388 +0x125
cmd/compile/internal/noder.(*reader).typ(...)
cmd/compile/internal/noder/reader.go:382
cmd/compile/internal/noder.(*reader).doTyp(0xc001852280)
cmd/compile/internal/noder/reader.go:520 +0x297
cmd/compile/internal/noder.(*pkgReader).typIdx(...)
cmd/compile/internal/noder/reader.go:429
cmd/compile/internal/noder.(*reader).typWrapped(0xc001844140, 0x1)
cmd/compile/internal/noder/reader.go:388 +0x125
cmd/compile/internal/noder.(*reader).typ(...)
cmd/compile/internal/noder/reader.go:382
cmd/compile/internal/noder.(*reader).param(...)
cmd/compile/internal/noder/reader.go:622
cmd/compile/internal/noder.(*reader).params(0xc001844140)
cmd/compile/internal/noder/reader.go:615 +0xad
cmd/compile/internal/noder.(*reader).signature(0xc001844140, 0xc001848870)
cmd/compile/internal/noder/reader.go:603 +0x5c
cmd/compile/internal/noder.(*reader).method(0xc001844140, 0xc001844280)
cmd/compile/internal/noder/reader.go:1023 +0x94
cmd/compile/internal/noder.(*pkgReader).objIdxMayFail(0xc000ad56c0, 0xcd, {0x0, 0x0, 0x0}, {0x721b420, 0x0, 0x0}, 0x0)
cmd/compile/internal/noder/reader.go:816 +0xd76
cmd/compile/internal/noder.(*pkgReader).objIdx(...)
cmd/compile/internal/noder/reader.go:670
cmd/compile/internal/noder.(*pkgReader).objInstIdx(0xc000ad56c0, {0xccf628?, {0x721b420?, 0x610d669?, 0x8?}}, 0x0, 0x0)
cmd/compile/internal/noder/reader.go:662 +0x96
cmd/compile/internal/noder.(*reader).obj(0xc000fed400)
cmd/compile/internal/noder/reader.go:634 +0x46
cmd/compile/internal/noder.(*reader).pkgObjs(0xc000fed400, 0xc000000240)
cmd/compile/internal/noder/reader.go:3314 +0x9d
cmd/compile/internal/noder.(*reader).pkgDecls(0xc000fed400, 0xc000000240)
cmd/compile/internal/noder/reader.go:3303 +0x18f
cmd/compile/internal/noder.(*reader).pkgInit(0xc000fed400, 0xc00007a320?, 0xc000000240)
cmd/compile/internal/noder/reader.go:3209 +0xe5
cmd/compile/internal/noder.unified({0x0?, {0x0?, 0x0?}}, {0xc000158380?, 0x6b64b00?, 0x0?})
cmd/compile/internal/noder/unified.go:188 +0x17c
cmd/compile/internal/noder.LoadPackage({0xc000022358, 0x10, 0x12})
cmd/compile/internal/noder/noder.go:77 +0x43a
cmd/compile/internal/gc.Main(0x6c18470)
cmd/compile/internal/gc/main.go:197 +0xbbd
main.main()
cmd/compile/main.go:57 +0xf9
The text was updated successfully, but these errors were encountered: