-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
What version of Go are you using (go version
)?
$ ../bin/go version
go version devel +ce536837d8 Sun Sep 23 19:59:57 2018 +0000 linux/amd64
Does this issue reproduce with the latest release?
No, only present in master
What operating system and processor architecture are you using (go env
)?
$ ../bin/go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/rski/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rski/go"
GOPROXY=""
GORACE=""
GOROOT="/home/rski/Code/go"
GOTMPDIR=""
GOTOOLDIR="/home/rski/Code/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-build909293570=/tmp/go-build -gno-record-gcc-switches"
const mask = 0x4000
func TestGoRegression(t *testing.T) {
value := uint64(100000000000000000)
fmt.Println((value >> 48) & (^uint64(mask)))
foo(value)
}
func foo(value uint64) {
fmt.Println((value >> 48) & (^uint64(mask)))
}
/home/rski/Code/go/bin/go test -run "TestGoRegression" ./... -v -count=1
=== RUN TestGoRegression
355
0
However, this does the right thing:
const mask = 0x4000
func TestGoRegression(t *testing.T) {
value := uint64(100000000000000000)
fmt.Println((value >> 48) & (^uint64(mask)))
fmt.Println(foo(value))
}
func foo(value uint64) uint64 {
return ((value >> 48) & (^uint64(mask)))
}
/home/rski/Code/go/bin/go test -run "TestGoRegression" ./... -v -count=1
=== RUN TestGoRegression
355
355
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.