New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: uint64(Float32bits(f)) on amd64 doesn't clear high bits #25322
Comments
I get
|
Which is not the right value. The MSB 32 bits should be zero |
/cc @TocarIP @josharian |
Thanks! I’m AFK for a bit. If anyone has time to bisect that’d be helpful. |
Git bisect points to 229aaac. Not sure if that makes sense...
|
My guess is that on a different machine/OS/platform bisect may point to a different commit. |
Yeah, scratch that, the generated code for |
Ok, so after fb05948 the generated asm changed from old:
to new:
This sequence:
disappeared, and was replaced by a single |
Thanks, @ALTree. cc @randall77 This is definitely a backport candidate. |
Change https://golang.org/cl/112637 mentions this issue: |
@gopherbot please consider this for backport to 1.10, it results in incorrect code generation. |
Backport issue(s) opened: #25335 (for 1.10). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
happens on GOOS="linux"
What did you do?
the high 32 bits of uint64(math.Float32bits(x)) are not zero
If possible, provide a recipe for reproducing the error.
this produces "c440000000"
What did you expect to see?
40000000
What did you see instead?
c40000000
The high order bits are not cleared in the cast to uint64
works fine in 1.9.6 and the generated code in 1.10.2 seems to optimize the cast out.
The text was updated successfully, but these errors were encountered: