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: tip crashes on too-large package-level array declarations #49814

Closed
go101 opened this issue Nov 27, 2021 · 3 comments
Closed

cmd/compile: tip crashes on too-large package-level array declarations #49814

go101 opened this issue Nov 27, 2021 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@go101
Copy link

go101 commented Nov 27, 2021

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

$ go version
go version devel go1.18-fad67f8a53 Sat Nov 27 01:14:21 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

Tip only.

What did you do?

package main

var X [1<<50]byte

func main() {}

What did you expect to see?

Not crash, just fails to compile.

What did you see instead?

Crash

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 27, 2021
@ianlancetaylor ianlancetaylor added this to the Go1.18 milestone Nov 27, 2021
@ianlancetaylor
Copy link
Contributor

To clarify, it is the compiler that crashes, not the program.

CC @griesemer @findleyr

> go build foo.go
# command-line-arguments
<unknown line number>: internal compiler error: bad type: [1125899906842624]byte

goroutine 1 [running]:
runtime/debug.Stack()
	/home/iant/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x10?, 0x0?}, {0xd1d117, 0xc}, {0xc00057b380, 0x1, 0x1})
	/home/iant/go/src/cmd/compile/internal/base/print.go:227 +0x1ca
cmd/compile/internal/base.Fatalf(...)
	/home/iant/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/types.typePos(0xc0004278f0?)
	/home/iant/go/src/cmd/compile/internal/types/size.go:53 +0xad
cmd/compile/internal/types.CalcSize(0xc0000ac310)
	/home/iant/go/src/cmd/compile/internal/types/size.go:495 +0x59e
cmd/compile/internal/types.ResumeCheckSize()
	/home/iant/go/src/cmd/compile/internal/types/size.go:628 +0x4e
cmd/compile/internal/noder.(*irgen).typ(0xc0000b6000, {0xe8bba8?, 0xc000414090?})
	/home/iant/go/src/cmd/compile/internal/noder/types.go:38 +0x3d
cmd/compile/internal/noder.(*irgen).obj(0xc0000b6000, {0xe8ee30, 0xc000424240?})
	/home/iant/go/src/cmd/compile/internal/noder/object.go:147 +0x965
cmd/compile/internal/noder.(*irgen).def(0xc0000b6000, 0xc0000a6020)
	/home/iant/go/src/cmd/compile/internal/noder/object.go:22 +0xbd
cmd/compile/internal/noder.(*irgen).varDecl(0xc0000b6000, 0xc0001640f0, 0xc000424120)
	/home/iant/go/src/cmd/compile/internal/noder/decl.go:243 +0xe5
cmd/compile/internal/noder.(*irgen).decls(0xc0000b6000?, 0xc000596070?, {0xc0000a60a0?, 0x2, 0x203000?})
	/home/iant/go/src/cmd/compile/internal/noder/decl.go:34 +0xfd
cmd/compile/internal/noder.(*irgen).generate(0xc0000b6000, {0xc00006aa90, 0x2, 0x203000?})
	/home/iant/go/src/cmd/compile/internal/noder/irgen.go:270 +0x1ed
cmd/compile/internal/noder.check2({0xc00006aa90, 0x2, 0x2})
	/home/iant/go/src/cmd/compile/internal/noder/irgen.go:92 +0x16d
cmd/compile/internal/noder.LoadPackage({0xc00001e210, 0x2, 0x0?})
	/home/iant/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd496c0)
	/home/iant/go/src/cmd/compile/internal/gc/main.go:191 +0xb13
main.main()
	/home/iant/go/src/cmd/compile/main.go:55 +0xdd

@griesemer
Copy link
Contributor

The crash happens while trying to report error "type %L larger than address space"; it appears that the type position is unknown.

@gopherbot
Copy link

Change https://golang.org/cl/367955 mentions this issue: cmd/compile: report channel size errors correctly for -G=3

@golang golang locked and limited conversation to collaborators Jun 23, 2023
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