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: bad mpint length: 65 > 64 #54280

Open
JayMonari opened this issue Aug 5, 2022 · 2 comments
Open

cmd/compile: bad mpint length: 65 > 64 #54280

JayMonari opened this issue Aug 5, 2022 · 2 comments
Assignees
Labels
compiler/runtime NeedsInvestigation
Milestone

Comments

@JayMonari
Copy link

JayMonari commented Aug 5, 2022

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

$ go version
go version go1.19 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/jay/.local/bin"
GOCACHE="/home/jay/.cache/go-build"
GOENV="/home/jay/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jay/.local/share/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jay/.local/share/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jay/src/go/playground/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1919621165=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://go.dev/play/p/_jct1xi435j

What did you expect to see?

Nothing, I was just exploring untyped constants

What did you see instead?

# playtime
./main.go:10:13: internal compiler error: bad mpint length: 65 > 64 (type untyped int, value 912345678901234567890123456789012345678901234567890912345678901234567890123456789012345678901234567890912345678901234567890123456789012345678901234567890912)

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

This could be a false alarm, I'm just following what the toolchain asked me to do.

@mengzhuo mengzhuo changed the title internal compiler error: bad mpint length: 65 > 64 cmd/compile: bad mpint length: 65 > 64 Aug 5, 2022
@gopherbot gopherbot added the compiler/runtime label Aug 5, 2022
@mengzhuo mengzhuo added NeedsInvestigation compiler/runtime and removed compiler/runtime labels Aug 5, 2022
@mknyszek mknyszek added this to the Backlog milestone Aug 10, 2022
@mknyszek
Copy link
Contributor

mknyszek commented Aug 10, 2022

CC @golang/compiler

Optimistically assigning to @griesemer but giving it a low priority since this case doesn't seem like it would come up much in practice. Seems like it could just use a better error message. @griesemer Please feel free to unassign!

@mdempsky
Copy link
Member

mdempsky commented Aug 10, 2022

The crash is actually happening in iexport, but the issue is that the integer constant requires more than 64 bytes (512 bits) to represent.

I think the issue is that types2 rejects arithmetic that overflows 512 bits, but evidently it doesn't check that constant literals themselves fit into 512 bits. If I change the declaration of BIG to include + 0, then types2 reports "constant addition overflow" even though it represents the same value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime NeedsInvestigation
Projects
Status: Todo
Development

No branches or pull requests

6 participants