profile
viewpoint

Ask questionscmd/compile: "truncation is not exact" ICE while compiling on ppc64le on QEMU

<!-- Please answer these questions before submitting your issue. Thanks! -->

What version of Go are you using (go version)?

<pre> $ go version go version go1.13 linux/ppc64le </pre>

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

<details><summary><code>go env</code> Output</summary><br><pre> $ go env GO111MODULE="" GOARCH="ppc64le" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="ppc64le" GOHOSTOS="linux" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/root/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/peon/godev/go1.13/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/peon/godev/go1.13/go/pkg/tool/linux_ppc64le" GCCGO="gccgo" GOPPC64="power8" AR="ar" 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 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build688207401=/tmp/go-build -gno-record-gcc-switches"

</pre></details>

What did you do?

Building prometheus/node_exporter fails.

Running a Debian 9 (stretch) ppc64le QEMU VM on Debian 10 (buster) amd64 host. QEMU 3.1 and 4.1 both produce the same compile error.

<pre> GO111MODULE=on /home/peon/.buildkite-agent/builds/debian-9-4-0-ppc64le-build-prometheus-io-1/prometheus/node-exporter-5b1a191e7471d00deeee08ce305d1de245243936-2122-nYyt/bin/promu --config .promu.yml build --prefix /home/peon/.buildkite-agent/builds/debian-9-4-0-ppc64le-build-prometheus-io-1/prometheus/node-exporter-5b1a191e7471d00deeee08ce305d1de245243936-2122-nYyt/src/github.com/prometheus/node_exporter   | > node_exporter   | # runtime   | /home/peon/godev/go/src/runtime/runtime1.go:162:22: internal compiler error: 'check': panic during opt while compiling check:   |     | truncate64Fto32F: truncation is not exact   |     | goroutine 129 [running]:   | cmd/compile/internal/ssa.Compile.func1(0xc0023aefa8, 0xc003c78f20)   | /usr/local/go/src/cmd/compile/internal/ssa/compile.go:47 +0x9c   | panic(0x8c63a0, 0xaf8740)   | /usr/local/go/src/runtime/panic.go:679 +0x1bc   | cmd/compile/internal/ssa.truncate64Fto32F(0xc7ffffffe0000000, 0xc000000852)   | /usr/local/go/src/cmd/compile/internal/ssa/rewrite.go:444 +0xdc   | cmd/compile/internal/ssa.auxTo32F(...)   | /usr/local/go/src/cmd/compile/internal/ssa/rewrite.go:494   | cmd/compile/internal/ssa.rewriteValuegeneric_OpEq32F_0(0xc00255ae58, 0xffffffffffffff01)   | /usr/local/go/src/cmd/compile/internal/ssa/rewritegeneric.go:19739 +0x128   | cmd/compile/internal/ssa.rewriteValuegeneric(0xc00255ae58, 0x0)   | /usr/local/go/src/cmd/compile/internal/ssa/rewritegeneric.go:105 +0x18dc   | cmd/compile/internal/ssa.applyRewrite(0xc003c78f20, 0x96be28, 0x96bea0)   | /usr/local/go/src/cmd/compile/internal/ssa/rewrite.go:80 +0x538   | cmd/compile/internal/ssa.opt(0xc003c78f20)   | /usr/local/go/src/cmd/compile/internal/ssa/opt.go:9 +0x44   | cmd/compile/internal/ssa.Compile(0xc003c78f20)   | /usr/local/go/src/cmd/compile/internal/ssa/compile.go:92 +0x8a4   | cmd/compile/internal/gc.buildssa(0xc0016f2840, 0x1, 0x0)   | /usr/local/go/src/cmd/compile/internal/gc/ssa.go:289 +0x778   | cmd/compile/internal/gc.compileSSA(0xc0016f2840, 0x1)   | /usr/local/go/src/cmd/compile/internal/gc/pgen.go:298 +0x38   | cmd/compile/internal/gc.compileFunctions.func2(0xc0026f4480, 0xc000501280, 0x1)   | /usr/local/go/src/cmd/compile/internal/gc/pgen.go:363 +0x40   | created by cmd/compile/internal/gc.compileFunctions   | /usr/local/go/src/cmd/compile/internal/gc/pgen.go:361 +0x12c   |     |     |     | Please file a bug report including a short program that triggers the error.   | https://golang.org/issue/new   | !! command failed: build -o /home/peon/.buildkite-agent/builds/debian-9-4-0-ppc64le-build-prometheus-io-1/prometheus/node-exporter-5b1a191e7471d00deeee08ce305d1de245243936-2122-nYyt/src/github.com/prometheus/node_exporter/node_exporter -ldflags -X github.com/prometheus/common/version.Version=0.18.1 -X github.com/prometheus/common/version.Revision=non-git -X github.com/prometheus/common/version.Branch=non-git -X github.com/prometheus/common/version.BuildUser=peon@debian-9-4-0-ppc64le.build.prometheus.io -X github.com/prometheus/common/version.BuildDate=20190906-08:37:12 -extldflags '-static' -mod=vendor -a -tags 'netgo static_build' github.com/prometheus/node_exporter: exit status 2 <pre>

golang/go

Answer questions laboger

Here is the merge commit that includes the fixes:

Merge: 3483534 b1e8156
Author: Peter Maydell <peter.maydell@linaro.org>
Date:   Tue Sep 3 17:20:39 2019 +0100
    Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.2-20190829' into staging
    
    ppc patch queue 2018-08-29
    
    Another pull request for ppc-for-4.2.  Includes
    
      * Several powernv patches which were pulled last minute from the
        last PULL, now that some problems with them have been sorted out
      * A fix for -no-reboot which has been broken since the
        pseries-rhel4.1.0 machine type
      * Add some host threads information which AIX guests will need to
        properly scale the PURR and SPURR
      * Change behaviour to match x86 when unplugging function 0 of a
        multifunction PCI device
      * A number of TCG fixes in FPU emulation
    
    And a handful of other assorted fixes and cleanups.
useful!

Related questions

cmd/link: segmentation fault during mach-o linking
cmd/go: cannot find module providing package error stops `go get` processing hot 3
vendor/golang.org/x/xerrors/adaptor_go1_13.go:16:14: undefined: errors.Frame ... hot 2
cmd/vet: potential false positive in the "suspect or" check hot 2
cmd/go: needs a better error than "missing dot in first path element" when GOROOT is set incorrectly hot 2
x/xerrors: fails to compile on tip hot 1
cmd/go: `go clean <package>` downloads modules hot 1
cmd/cgo error: runtime: unknown pc 0x7fff5c805b86 hot 1
runtime: crash with "invalid pc-encoded table" hot 1
cmd/link: showing many ld warnings of "building for macOS, but linking in object file" hot 1
runtime: go program crach, it seems fall into infinite loop hot 1
cmd/go: major version without preceding tag must be v0, not v1 - breaks build of github.com/go-check hot 1
gollvm: Using External Go Packages with gollvm hot 1
runtime: macOS Sierra builders spinning hot 1
cmd/go: Problem using go modules hot 1
Github User Rank List