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: bitwise OR of fp constants triggers an internal compiler error #31060

Closed
nsajko opened this issue Mar 26, 2019 · 7 comments

Comments

Projects
None yet
6 participants
@nsajko
Copy link
Contributor

commented Mar 26, 2019

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

$ go version
go version go1.12.1 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
GOARCH="amd64"
GOBIN=""
GOCACHE="/tmp/freedesktopCache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/nsajko"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build891538814=/tmp/go-build -gno-record-gcc-switches"

What did you do?

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

What did you expect to see?

No "internal compiler error". Probably a message like "operator | not defined on floating point constants" would be nice.

What did you see instead?

internal compiler error: binaryOp: bad operation: 3.5 | 2.8
@josharian

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

@josharian josharian changed the title Bitwise OR of fp constants triggers an internal compiler error cmd/compile: bitwise OR of fp constants triggers an internal compiler error Mar 26, 2019

@josharian josharian added the NeedsFix label Mar 26, 2019

@josharian josharian added this to the Go1.13 milestone Mar 26, 2019

@mark-rushakoff

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

Looks like was not an ICE in 1.11.

$ go version; go build x.go
go version go1.11.4 darwin/amd64
# command-line-arguments
./x.go:8:18: illegal constant expression: untyped number | untyped number
@mdempsky

This comment has been minimized.

Copy link
Member

commented Mar 27, 2019

Technically, an "illegal constant expression" was still an ICE. ;)

But yes, hmm, this is definitely related to my const.go refactoring. I'll take a look.

@gopherbot

This comment has been minimized.

Copy link

commented Mar 27, 2019

Change https://golang.org/cl/169719 mentions this issue: cmd/compile: fix ICE from invalid operations on float/complex constants

@mdempsky

This comment has been minimized.

Copy link
Member

commented Mar 28, 2019

This might be worth backporting to Go 1.12. It's only affects invalid Go code (i.e., failing with ICE instead of emitting a proper compiler error), but it's still technically a regression in Go 1.12 from Go 1.11.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Mar 28, 2019

The guideline on backports isn't to fix all regressions, it's to only backport patches that fix serious bugs with no workaround. There is always a workaround for invalid code, so I don't think we need to backport this.

@mdempsky

This comment has been minimized.

Copy link
Member

commented Mar 28, 2019

@ianlancetaylor Okay, SGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.