Repository: go
Issue: cmd/compile: panic: runtime error: floating point error when building on FreeBSD armv6 on RPi-B
Labels: OS-FreeBSD,NeedsInvestigation,arch-arm,compiler/runtime

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

go1.4 bootstrap

### 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>
$ /usr/local/go14/bin/go env
GOARCH="arm"
GOBIN=""
GOCHAR="5"
GOEXE=""
GOHOSTARCH="arm"
GOHOSTOS="freebsd"
GOOS="freebsd"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go14"
GOTOOLDIR="/usr/local/go14/pkg/tool/freebsd_arm"
CC="clang"
GOGCCFLAGS="-fPIC -marm -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0"
CXX="clang++"
CGO_ENABLED="0"
$ 


</pre></details>

### What did you do?

I tried to build go1.14.4


### What did you expect to see?

A successful build of go1.14.4



### What did you see instead?

Build fails with SIGFPE. The output below comes from a build from FreeBSD ports. Building from source directly (using go1-4 bootstrap) results in the same error.

<pre>
root@rpi-b:/usr/ports/lang/go # make -DBATCH
===>  License BSD3CLAUSE accepted by the user
===>   go-1.14.4,1 depends on file: /usr/local/sbin/pkg - found
=> go1.14.4.src.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch https://golang.org/dl/go1.14.4.src.tar.gz
go1.14.4.src.tar.gz                                     21 MB 1695 kBps    13s
=> go-freebsd-arm6-go1.14.tar.xz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch https://github.com/dmgk/go-bootstrap/releases/download/go1.14/go-freebsd-arm6-go1.14.tar.xz
go-freebsd-arm6-go1.14.tar.xz                           33 MB 1472 kBps    24s
===> Fetching all distfiles required by go-1.14.4,1 for building
===>  Extracting for go-1.14.4,1
=> SHA256 Checksum OK for go1.14.4.src.tar.gz.
=> SHA256 Checksum OK for go-freebsd-arm6-go1.14.tar.xz.
===>  Patching for go-1.14.4,1
===>  Applying FreeBSD patches for go-1.14.4,1 from /usr/ports/lang/go/files
===>  Configuring for go-1.14.4,1
===>  Building for go-1.14.4,1
cd /usr/ports/lang/go/work/go/src ; /usr/bin/env  XDG_CACHE_HOME=/usr/ports/lang/go/work  GOROOT_BOOTSTRAP=/usr/ports/lang/go/work/go-freebsd-arm6-bootstrap  GOROOT=/usr/ports/lang/go/work/go  GOROOT_FINAL=/usr/local/go  GOBIN=  GOOS=freebsd  GOARCH=arm  GO386=  GOARM=6  /bin/sh make.bash -v
-ap: not found
go: not found
Building Go cmd/dist using /usr/ports/lang/go/work/go-freebsd-arm6-bootstrap. (go1.14 freebsd/arm)
cmd/dist

Building Go toolchain1 using /usr/ports/lang/go/work/go-freebsd-arm6-bootstrap.
math/bits
math
# math
panic: runtime error: floating point error
[signal SIGFPE: floating-point exception code=0x0 addr=0x8317bc pc=0x8317bc]

goroutine 1 [running]:
math.IsInf(...)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/math/bits.go:51
cmd/compile/internal/gc.(*Mpflt).Float64(0x318805e0, 0x200, 0x318df5e0)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/mpfloat.go:139 +0x30
cmd/compile/internal/gc.truncfltlit(0x318805e0, 0x31440e40, 0x9c4af0)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/const.go:168 +0x90
cmd/compile/internal/gc.convertVal(0x9c4af0, 0x318805e0, 0x31440e40, 0x0, 0x9c4af0, 0x318df5c0)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/const.go:398 +0xb8
cmd/compile/internal/gc.convlit1(0x318880a0, 0x31440e40, 0x0, 0x3177540c, 0x318e6301)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/const.go:272 +0x248
cmd/compile/internal/gc.assignconvfn(0x318880a0, 0x31440e40, 0x3177540c, 0x318e6320)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/subr.go:805 +0x74
cmd/compile/internal/gc.assignconv(0x318880a0, 0x31440e40, 0x9e1072, 0xd, 0x318e6320)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/subr.go:792 +0x5c
cmd/compile/internal/gc.typecheckarraylit(0x31440e40, 0xffffffff, 0xffffffff, 0x31760d50, 0xb, 0xb, 0x9e1072, 0xd, 0xa, 0x0)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/typecheck.go:2999 +0x180
cmd/compile/internal/gc.typecheckcomplit(0x3187fc20, 0x0)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/typecheck.go:2785 +0x1cc0
cmd/compile/internal/gc.typecheck1(0x3187fc20, 0x12, 0x0)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/typecheck.go:860 +0x3cf4
cmd/compile/internal/gc.typecheck(0x3187fc20, 0x12, 0x0)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/typecheck.go:300 +0x640
cmd/compile/internal/gc.typecheckas(0x318880f0)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/typecheck.go:3172 +0x94
cmd/compile/internal/gc.typecheck1(0x318880f0, 0x1, 0x0)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/typecheck.go:1900 +0x29b8
cmd/compile/internal/gc.typecheck(0x318880f0, 0x1, 0x0)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/typecheck.go:300 +0x640
cmd/compile/internal/gc.Main(0xa00d70)
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/internal/gc/main.go:580 +0x2d18
main.main()
        /home/dg/golang/go-bootstrap/go-freebsd-arm6-bootstrap/src/cmd/compile/main.go:52 +0x98
bootstrap/sort
bootstrap/math/bits
bootstrap/container/heap
bootstrap/internal/goversion
bootstrap/internal/race
go tool dist: FAILED: /usr/ports/lang/go/work/go-freebsd-arm6-bootstrap/bin/go install -gcflags=-l -tags=math_big_pure_go compiler_bootstrap -v bootstrap/cmd/...: exit status 2
*** Error code 2

Stop.
make: stopped in /usr/ports/lang/go
</pre>