cmd/compile: uint32(math.NaN()) returns -1 on riscv64, but 0 on all other architectures #64917
Labels
arch-riscv
Issues solely affecting the riscv64 architecture.
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Go version
go version go1.21.5 linux/riscv64
What operating system and processor architecture are you using (
go env
)?What did you do?
I am trying to find a solution this bug detected by Debian buildd: https://buildd.debian.org/status/package.php?p=golang-github-evanw-esbuild:
I have made a minimal reproducible example (MRE) here: https://go.dev/play/p/JwilhWMDl9k
Please save it locally as test-uint32-nan.go.
go run test-uint32-nan.go
on amd64 givesuint32(math.NaN()) returns 0 on amd64 (linux).
just as in the Go Playground.Test riscv64 either on native riscv64 machine, or on e.g. amd64 with QEMU installed with:
What did you expect to see?
What did you see instead?
This difference of
uint32(math.NaN())
output between riscv64 and other architectures results in:It would be really nice if riscv64 could produce an identical result here, as it seems to be the only oddball out giving a different result.
Many thanks!
Happy New Year!
The text was updated successfully, but these errors were encountered: