-
Notifications
You must be signed in to change notification settings - Fork 17
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
test_biniou fails on ppc64 #13
Comments
Sorry I haven't found the time to look into it. |
This is a copy of the test from bi_io.ml: let safety_test () =
let s = "\x3f\xf0\x06\x05\x04\x03\x02\x01" in
let x = 1.00146962706651288 in
let y = read_untagged_float64 (Bi_inbuf.from_string s) in
if x <> y then
assert false;
let ob = Bi_outbuf.create 8 in
write_untagged_float64 ob x;
if Bi_outbuf.contents ob <> s then
assert false Could you post the result of the following code:
It should end in |
Martin - my colleague is not an OCaml developer so he's not very familiar with using the compiler, toplevel and so on. Rafael - here is how to get the results that Martin wants. This assumes: (1) You have Step 1: Create a file called
Step 2: Run it using:
The output on x86 (NOT affected by the bug) is:
|
Of course there is (maybe?) the problem that by using Step 3: Remove all Step 4: Run these two command (again, changing the path):
|
Richard, thank you for the explanation. Here is the result ('le' means little endian): |
Martin: When analyzing this, don't discount the possibility that there could be a bug in the compiler. We are using our own non-upstream ppc64 & ppc64le backends, and while they are generally reliable, we have found bugs before. |
Thanks guys. Here's a test that should tell us if the bug is in OCaml or in the biniou library: File open Printf
let read_bits_from_constant () =
let expected = "3ff0060504030201" in
let result =
sprintf "%0Lx"
(Int64.bits_of_float 1.00146962706651288)
in
printf "read_bits_from_constant: %s %s\n"
result (if result = expected then "OK" else "ERROR")
let read_bits_from_string () =
let expected = "3ff0060504030201" in
let result =
sprintf "%0Lx"
(Int64.bits_of_float (float_of_string "1.00146962706651288"))
in
printf "read_bits_from_string: %s %s\n"
result (if result = expected then "OK" else "ERROR")
let main () =
read_bits_from_constant ();
read_bits_from_string ()
let () = main () Test the bytecode version of the program with:
Test the native code version of the program with:
In both cases, the output should be:
|
Bytecode version: Native version: |
Thanks. That's interesting. It looks like a somewhat limited problem, which would affect folks who hardcode long constants. As a workaround, I can modify the test in I'm gonna file a report for this bug with the OCaml bug tracker. I'll post the link here. |
The bug report is at http://caml.inria.fr/mantis/view.php?id=6963 |
Martin, thank you for debugging the issue and filling the report. I added a comment there specifying the ocaml version used. |
From what I see this has been fixed in upstream by providing a compiler with ppc64 support directly. |
A float comparison fails on ppc64 on line 264 of the test_biniou file. As it can be seen from the log below, I added a print to the respective line in the test and it fails although both numbers seem equal.
$ ./test_biniou
x = 1.001470 y = 1.001470
Fatal error: exception File "bi_io.ml", line 265, characters 4-10: Assertion failed
The text was updated successfully, but these errors were encountered: