Navigation Menu

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 on complex modulo instead of compilation failure #33461

Closed
niaow opened this issue Aug 4, 2019 · 3 comments
Milestone

Comments

@niaow
Copy link

niaow commented Aug 4, 2019

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

$ go version
go version go1.12.7 linux/amd64

Does this issue reproduce with the latest release?

Yes I think.

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jadenw/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jadenw/GOPATH"
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-build531868898=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I forgot whether the spec allows modulo on complex numbers (and I now know it does not), so I tried it on the playground.

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

What did you expect to see?

The correct behavior would be to spit out an error something like % operator not defined for complex numbers.

What did you see instead?

./prog.go:8:16: internal compiler error: binaryOp: bad operation: 1i % 1

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

Go build failed.

Notes

This only appears to happen for inline constant expressions. When breaking it up with variables, it spits out a proper error.

@odeke-em
Copy link
Member

odeke-em commented Aug 4, 2019

Thank you for this report @jadr2ddude!

We shall get this fixed for Go1.14.

@odeke-em odeke-em changed the title cmd/compile: internal compiler error on complex modulo cmd/compile: internal compiler error on complex modulo instead of compilation failure Aug 4, 2019
@odeke-em odeke-em self-assigned this Aug 4, 2019
@odeke-em odeke-em added this to the Go1.14 milestone Aug 4, 2019
@cuonglm
Copy link
Member

cuonglm commented Aug 5, 2019

This is duplicated of #32723, and should be fixed in https://go-review.googlesource.com/c/go/+/183459

$ go run main.go 
# command-line-arguments
./main.go:8:17: invalid operation: operator % not defined on untyped complex

@niaow
Copy link
Author

niaow commented Aug 5, 2019

Oops! I looked around for a previous report, but nothing had showed up when I originally looked. Thanks, closing as a duplicate.

@niaow niaow closed this as completed Aug 5, 2019
@golang golang locked and limited conversation to collaborators Aug 4, 2020
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

5 participants