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
Broken float constant in native code, ppc64 #6963
Comments
Comment author: rdossant The ocaml version I tested against is actually 4.02.0. I tested on both PPC64 big endian and little endian. |
Comment author: Richard Jones This could be a bug in our downstream ppc64 backend ( https://git.fedorahosted.org/cgit/fedora-ocaml.git/tree/asmcomp/power64?h=fedora-24-4.02 ) |
Comment author: @xavierleroy As Richard wrote, PPC64 is not supported by "upstream" OCaml 4.02.0, so the reporter must be using RedHat's "downstream" back-end. An "upstream" PPC64 port is in progress (see #225). For what it's worth, the test case works fine with this port. Did you run the test using the bytecode compiler? There is a very small chance that the problem is in the strtod() C library function, in which case the problem would manifest both in bytecode and in native-code. |
Comment author: @xavierleroy I see from the "biniou" discussion that the problem doesn't occur in bytecode. So, the problem seems to come from the "downstream" PPC64 native-code generator. |
Comment author: Richard Jones Hi Xavier, as you say I am also sure this is a bug in our downstream backend and not in OCaml. Still studying it on my local VM. |
Comment author: Richard Jones [Bleah, Mantis ate the long comment I wrote here.] There's obviously a bug in the downstream ppc64 & ppc64le code generators. They currently generate this assembler: %% were the literal is obviously truncated. The patch to fix this is something like: %%
(similarly for the other backend). I'm still testing the above. Very keen to switch to the new combined-ppc backend as soon as possible so we don't have to maintain our own! |
Comment author: Richard Jones Red Hat BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1255135 |
Comment author: Richard Jones The attached patch fixes the issue in Red Hat's ppc64be/le backends. Since this doesn't apply to the upstream OCaml, you can just close this bug. |
Original bug ID: 6963
Reporter: @mjambon
Status: closed (set by @xavierleroy on 2015-08-20T09:53:38Z)
Resolution: not a bug
Priority: normal
Severity: minor
Platform: ppc64
OS: Linux
Version: 4.02.0
Category: back end (clambda to assembly)
Monitored by: "Richard Jones"
Bug description
The last two bytes of a float constant are incorrectly interpreted (ocamlopt on ppc64). The runtime representation of the float 1.00146962706651288 should be 0x3ff0060504030201 but instead we get 0x3ff0060504033f5a.
prints:
See conversation at ocaml-community/biniou#13 (comment) and attached file.
The bug was originally found in the biniou library by Rafael Fonseca with the help of Richard W Jones.
Steps to reproduce
See attached file for full program.
File attachments
The text was updated successfully, but these errors were encountered: