-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
CherryPickApprovedUsed during the release process for point releasesUsed during the release process for point releasesFrozenDueToAgerelease-blocker
Milestone
Description
What version of Go are you using (go version
)?
go version go1.9.4 linux/amd64
Does this issue reproduce with the latest release?
Yes (go version devel +2010189407 Tue Feb 13 16:34:46 2018 +0000 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-build334481324=/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"
What did you do?
// Minimized reproducer for the (incorrect) translation of github.com/gcc-mirror/gcc/gcc/testsuite/gcc.c-torture/execute/pr70429.c
package main
func main() {
if foo(1) != int32(0x3edae8) {
panic(42)
}
}
func foo(_a int32) (r int32) {
//defer func() { println("r ", r) }() // <- Uncommenting this defer statement makes the panic go away.
return shr1(int32(shr2(int64(0x14ff6e2207db5d1f), int(_a))), 4)
}
func shr1(n int32, m int) int32 { return n >> uint(m) }
func shr2(n int64, m int) int64 {
if m < 0 { // <- Commenting out this if statement makes the panic go away.
m = -m
}
if m >= 64 { // <- Commenting out this if statement makes the panic go away.
return n
}
return n >> uint(m)
}
What did you expect to see?
No panic.
What did you see instead?
Panic.
Metadata
Metadata
Assignees
Labels
CherryPickApprovedUsed during the release process for point releasesUsed during the release process for point releasesFrozenDueToAgerelease-blocker