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: println(^uint(0)) fails to compile #21887
Comments
I think the problem is specific to
Replacing |
Use fmt.Println, the built-in println is a debugging feature which has
limited ability to print complex things.
…On Fri, 15 Sep 2017, 02:45 Mike MacDermaid ***@***.***> wrote:
What did you do?
https://play.golang.org/p/bIg5Wj5I4Q
In local builds
println(^uint(0))
Is a compile error
constant 18446744073709551615 overflows int64
In local tests and builds it prints -1
func TestOverflow(t *testing.T) {
asd := ^uint(0)
println(asd)
}
go test -test.run TestOverflow
-1
What did you expect to see?
4294967295
What did you see instead?
-1
System details
go version go1.9 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mmacdermaid/git/go"
GORACE=""
GOROOT="/home/mmacdermaid/goinstall/go"
GOTOOLDIR="/home/mmacdermaid/goinstall/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build297215887=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOROOT/bin/go version: go version go1.9 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.9
uname -sr: Linux 4.4.0-57-generic
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Ubuntu GLIBC 2.23-0ubuntu9) stable release version 2.23, by Roland McGrath et al.
gdb --version: GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#21887>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA65bqhY7tsnwy4njGzPxgLF4IGRRks5siVgrgaJpZM4PX31I>
.
|
👍 Good to know it's just println(). I can confirm using fmt.Println() over here correctly prints the right results. |
I'm going to close this as there doesn't seem to be an issue. |
Change https://golang.org/cl/63971 mentions this issue: |
Reopening this as there is a proper/code fix that @anfernee has up for review. |
What did you do?
https://play.golang.org/p/bIg5Wj5I4Q
In local builds
Is a compile error
In local tests and builds it prints -1
What did you expect to see?
4294967295
What did you see instead?
-1
System details
The text was updated successfully, but these errors were encountered: