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
jaddr2line opened this issue Aug 4, 2019 · 3 comments
Assignees
Milestone

Comments

@jaddr2line
Copy link

@jaddr2line jaddr2line 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

This comment has been minimized.

Copy link
Member

@odeke-em 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

This comment has been minimized.

Copy link
Contributor

@cuonglm 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
@jaddr2line

This comment has been minimized.

Copy link
Author

@jaddr2line jaddr2line 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.

@jaddr2line jaddr2line closed this Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.