-
Notifications
You must be signed in to change notification settings - Fork 176
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
read_int incorrectly reads (-1) #671
Comments
Yes. On a 32-bit platform, |
Why not just use OCaml compiler approach: let input_binary_int ic =
let b1 = input_byte ic in
let n1 = if b1 >= 128 then b1 - 256 else b1 in
let b2 = input_byte ic in
let b3 = input_byte ic in
let b4 = input_byte ic in
(n1 lsl 24) + (b2 lsl 16) + (b3 lsl 8) + b4 |
Thanks. I adapted this code, and the bug should be fixed by the attached commit. We are waiting on #658 (4.08 compatibility) for a release. In the meantime, would you mind testing whether Lwt
|
@aantron Dev lwt doesn't compile in my environment:
BTW, It would be great if you apply the following small fix needed for the recent Microsoft compilers: --- a/src/unix/config/discover.ml
+++ b/src/unix/config/discover.ml
@@ -324,14 +324,16 @@ let compile (opt, lib) stub_file =
let cmd fmt = ksprintf (fun s ->
dprintf "RUN: %s" s;
Sys.command s = 0) fmt in
+ let o_flag = if !ccomp_type = "msvc" then "-Fo:" else "-o" in
let obj_file = Filename.chop_suffix stub_file ".c" ^ !ext_obj
in
(* First compile the .c file using -ocamlc and CFLAGS (opt) *)
(cmd
- "%s -c %s %s -ccopt -o -ccopt %s >> %s 2>&1"
+ "%s -c %s %s -ccopt %s -ccopt %s >> %s 2>&1"
!ocamlc
(String.concat " " (List.map (fun x -> "-ccopt " ^ x) (List.map Filename.quote opt)))
(Filename.quote stub_file)
+ o_flag
(Filename.quote obj_file)
(Filename.quote !log_file))
&& |
Thanks for all that info, @db4! I committed what I think is a fix for the S-expression problem, and also applied your patch (I double-checked |
@aantron Lwt |
This function
lwt/src/unix/lwt_io.ml
Lines 1058 to 1069 in d791b9b
reads
-1
as-2
in 32-bit OCaml distribution. Isn't it a bug?The text was updated successfully, but these errors were encountered: