Closed
Description
What version of Go are you using (go version
)?
go version go1.11.2 linux/amd64
Does this issue reproduce with the latest release?
YES
What operating system and processor architecture are you using (go env
)?
go env
Output
GOARCH="amd64" GOBIN="" GOCACHE="/home/fred/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/fred/workspace/go" 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-build795351668=/tmp/go-build -gno-record-gcc-switches"
package mainimport (
"fmt"
)func main() {
id := 1
a := float32(2.0)
b := float32(5.0)
testOut(id, a*b)
}func testOut(id int, a float32) {
fmt.Println(id, a)
}$ env GOOS=linux GOARCH=arm go build -o test.arm7 main.go
running on raspberry pi 3 Model:B V:2
Linux PiOne 4.14.79-1-ARCH #1 SMP Tue Nov 6 03:01:46 UTC 2018 armv7l GNU/Linux$ ./test.arm7
What did you expect to see?
1 10
What did you see instead?
1073741824 10
When I do the multiplication outside the function call testOut() I get output (1 10).
Only happens when I do cross compilation.
When I cross compile and set GOARM=7, it works just fine.
env GOOS=linux GOARCH=arm GOARM=7 go build -o test.arm7 main.go