-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
CherryPickApprovedUsed during the release process for point releasesUsed during the release process for point releasesFrozenDueToAge
Milestone
Description
What version of Go are you using (go version)?
go version go1.8.3 linux/amd64
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jnml"
GORACE=""
GOROOT="/home/jnml/go"
GOTOOLDIR="/home/jnml/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build797922225=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
$ cat bug.go
package main
var a uint8
func main() {
b := int8(func() int32 { return -1 }())
a = uint8(b)
//println(a)
if int32(a) != 255 {
println("got", a, "expected 255")
}
}
$ go run bug.go
got 255 expected 255
$
What did you expect to see?
Nothing
What did you see instead?
got 255 expected 255
Additional info
- Uncommenting line 8 (
//println(a)) "fixes" the problem.
Metadata
Metadata
Assignees
Labels
CherryPickApprovedUsed during the release process for point releasesUsed during the release process for point releasesFrozenDueToAge