Skip to content
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

Error in the num library #4984

Closed
vicuna opened this Issue Feb 21, 2010 · 4 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

vicuna commented Feb 21, 2010

Original bug ID: 4984
Reporter: @glondu
Status: closed (set by @xavierleroy on 2010-04-18T08:46:03Z)
Resolution: fixed
Priority: normal
Severity: block
Version: 3.11.2
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

Hello,

An error in the num library makes some checks of coq's test-suite fail on the sparc port of Debian [1]. It boils down to:

$ ocaml nums.cma
Objective Caml version 3.11.2

open Num;;

let pow10 n = power_num (Int 10) (Int n);;

val pow10 : int -> Num.num =

string_of_num (pow10(-1) */ (Int 1) +/ Int 1);;

  • : string = "11/5"

which is obviously wrong. The same session on amd64 gives:

$ ocaml nums.cma
Objective Caml version 3.11.2

open Num;;

let pow10 n = power_num (Int 10) (Int n);;

val pow10 : int -> Num.num =

string_of_num (pow10(-1) */ (Int 1) +/ Int 1);;

  • : string = "11/10"

It looks like a consequence of commit 9320 (by doligez) in ocaml svn.

FYI, the sparc port of Debian is actually sparc64, but is detected as 32 bits by the configure script of ocaml [2].

Additional information

[1] https://buildd.debian.org/fetch.cgi?pkg=coq&arch=sparc&ver=8.2.pl1%2Bdfsg-5&stamp=1266762797&file=log&as=raw

[2] https://buildd.debian.org/fetch.cgi?pkg=ocaml&arch=sparc&ver=3.11.2-1&stamp=1265611860&file=log&as=raw

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 21, 2010

Comment author: @glondu

I've been told that it is a 64-bit kernel with a 32-bit userland, actually.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 24, 2010

Comment author: @xavierleroy

I have an old Sparc running an old version of Debian Linux, but it doesn't exhibit the problem: "11/10" is obtained. Moreover, commit 9320 affects only input_value on big ints, so I don't think it is related. I would rather suspect a change in gcc that could have exposed a problem in the Sparc-specific inline assembly.

If you're willing to test some more, you could start by turning off the Sparc-specific asm: just edit the toplevel "configure" file to remove the line that reads

sparc) bng_arch=sparc; bng_asm_level=1;;

Then you can rebuild OCaml as usual and see if the problem is still there. Do keep me informed of the results.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 24, 2010

Comment author: @glondu

Indeed, the same bug exists with the commit mentioned in the initial report reverted.

The bug disappears after commenting out the said line in configure.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 18, 2010

Comment author: @xavierleroy

Thanks for the test. Turned off selection of SPARC asm for BNG in configure. Better slower than wrong.

@vicuna vicuna closed this Apr 18, 2010

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.