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: internal compiler error: Int64Val(10000000000000000000) (dev.regabi branch) #43480

Closed
zikaeroh opened this issue Jan 3, 2021 · 4 comments

Comments

@zikaeroh
Copy link
Contributor

zikaeroh commented Jan 3, 2021

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

$ go version
go version devel +8fc44cf0fa Sun Jan 3 19:48:20 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

No, only on the regabi branch.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jake/.cache/go-build"
GOENV="/home/jake/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jake/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jake/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/jake/zikaeroh/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/jake/zikaeroh/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jake/decimal/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build867052434=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version devel +8fc44cf0fa Sun Jan 3 19:48:20 2021 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +8fc44cf0fa Sun Jan 3 19:48:20 2021 +0000
uname -sr: Linux 5.10.4-zen2-1-zen
/usr/lib/libc.so.6: GNU C Library (GNU libc) release release version 2.32.
gdb --version: GNU gdb (GDB) 10.1

What did you do?

Cloned https://github.com/ericlagergren/decimal, built the dev.regabi branch, and did a go build in the decimal checkout.

What did you expect to see?

No errors.

What did you see instead?

# github.com/ericlagergren/decimal/internal/arith
internal/arith/pow.go:65:17: internal compiler error: Int64Val(10000000000000000000)

goroutine 1 [running]:
runtime/debug.Stack(0xe8d1a0, 0xc00000e018, 0x0)
	/home/jake/zikaeroh/go/src/runtime/debug/stack.go:24 +0x9f
cmd/compile/internal/base.FatalfAt(0x4902000000080, 0xd5a11d, 0xc, 0xc0001055e8, 0x1, 0x1)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/base/print.go:227 +0x1b9
cmd/compile/internal/base.Fatalf(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/ir.Int64Val(0xe9bb50, 0xc000069c20, 0xde0b6b3a7640000)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/val.go:137 +0x105
cmd/compile/internal/walk.(*exprSwitch).flush(0xc0004db540)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/walk/switch.go:207 +0x4fa
cmd/compile/internal/walk.(*exprSwitch).Emit(0xc0004db540, 0xc0005d5ae0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/walk/switch.go:139 +0x2f
cmd/compile/internal/walk.walkSwitchExpr(0xc0005d5a80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/walk/switch.go:106 +0x910
cmd/compile/internal/walk.walkSwitch(0xc0005d5a80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/walk/switch.go:29 +0x46
cmd/compile/internal/walk.walkStmt(0xe9d8d8, 0xc0005d5a80, 0xe9c210, 0xc0005f4d90)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/walk/stmt.go:157 +0xc7a
cmd/compile/internal/walk.walkStmtList(0xc000081000, 0x31, 0x40)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/walk/stmt.go:172 +0x65
cmd/compile/internal/walk.Walk(0xc0004f4b40)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/walk/walk.go:44 +0xb3
cmd/compile/internal/gc.compile(0xc0004f4b40)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/compile.go:65 +0x54
cmd/compile/internal/gc.funccompile(0xc0004f4b40)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/compile.go:53 +0xc7
cmd/compile/internal/gc.Main(0xd7ed10)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/main.go:323 +0x115a
main.main()
	/home/jake/zikaeroh/go/src/cmd/compile/main.go:54 +0xb1

/cc @mdempsky

@mdempsky mdempsky self-assigned this Jan 3, 2021
@zikaeroh
Copy link
Contributor Author

zikaeroh commented Jan 3, 2021

Bisects to CL 272654 (unsurprising, I guess).

@gopherbot
Copy link

Change https://golang.org/cl/281272 mentions this issue: [dev.regabi] cmd/compile: fix ICE due to large uint64 constants

@gopherbot

This comment has been minimized.

gopherbot pushed a commit that referenced this issue Jan 4, 2021
It's an error to call Int64Val on constants that don't fit into
int64. CL 272654 made the compiler stricter about detecting misuse,
and revealed that we were using it improperly in detecting consecutive
integer-switch cases. That particular usage actually did work in
practice, but it's easy and best to just fix it.

Fixes #43480.

Change-Id: I56f722d75e83091638ac43b80e45df0b0ad7d48d
Reviewed-on: https://go-review.googlesource.com/c/go/+/281272
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
@zikaeroh
Copy link
Contributor Author

zikaeroh commented Jan 4, 2021

Closing as fixed on dev.regabi (GitHub won't autoclose this until it's merged into master).

@zikaeroh zikaeroh closed this as completed Jan 4, 2021
@golang golang locked and limited conversation to collaborators Jan 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants