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

installing 3.01 on FreeBSD 3.3 (i386) #2731

Closed
vicuna opened this issue Mar 21, 2001 · 3 comments
Closed

installing 3.01 on FreeBSD 3.3 (i386) #2731

vicuna opened this issue Mar 21, 2001 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 21, 2001

Original bug ID: 325
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

I had trouble getting ocaml 3.01 compiled on my system.
The compiler is gcc 2.7.2.3, the CPU is Pentium II.

After

./configure -prefix /home/proglang/packages/ocaml-3.01 -tkdefs
"-I/usr/local/include/tcl8.0 -I/usr/local/include/tk8.0" -tklibs
"-L/usr/local/lib -ltcl80 -ltk80"

the

make world

grinds to a stop when it tries to run the bytecode interpreter for the
first time:

cd stdlib; make COMPILER=../boot/ocamlc all
../boot/ocamlrun ../boot/ocamlc -g -nopervasives -c pervasives.mli
*** Signal 8

Stop.

Running it by hand yields

[hanauma] 105 > boot/ocamlrun boot/ocamlc
Floating exception(core dumped)

I looked at the core with gdb

[hanauma] 109 > gdb boot/ocamlrun ocamlrun.core
GNU gdb 4.18
(gdb) backtrace
#0  0x804b0f2 in copy_double ()
#1  0x804b84e in float_of_bytes ()
#2  0x805382c in interprete ()
#3  0x8054c98 in caml_main ()
#4  0x8049377 in main ()
#5  0x8049309 in _start ()

Then I restored the last couple of lines from
ocaml-3.00/byterun/floats.c:

/* The init_ieee_float function should initialize floating-point hardware
   so that it behaves as much as possible like the IEEE standard.
   In particular, return special numbers like Infinity and NaN instead
   of signalling exceptions. So far, only the Intel 386 under
   FreeBSD is not in IEEE mode at program startup.  */

#ifdef __i386__
#ifdef __FreeBSD__
#include <floatingpoint.h>
#endif
#endif

void init_ieee_floats(void)
{
#ifdef __i386__
#ifdef __FreeBSD__
  fpsetmask(0);
#endif
#endif
}

This change works for me and the compiler bootstraps successfully.

-Peter

@vicuna
Copy link
Author

vicuna commented Mar 27, 2001

Comment author: administrator

I had trouble getting ocaml 3.01 compiled on my system.
The compiler is gcc 2.7.2.3, the CPU is Pentium II.

Then I restored the last couple of lines from
ocaml-3.00/byterun/floats.c:

Hi Peter,

You have done the right thing, but Xavier also solved this problem in
a more fundamental way. See #2706.

Thank you for informing us that it also happens on 3.x, since I had wrong
information that it had been solved with 3.1R.
FreeBSD since 4.0R masks floating point exceptions, and ocaml-3.01 compiles
ok there. Upgrading to 4.2R (or 4.3R very soon) is a good idea anyway.

Jacques

@vicuna
Copy link
Author

vicuna commented Mar 27, 2001

Comment author: administrator

Extend fix to FreeBSD 3.x. JG 2000-03-27.

@vicuna vicuna closed this as completed Mar 27, 2001
@vicuna
Copy link
Author

vicuna commented Mar 29, 2001

Comment author: administrator

Hi Peter,

Then I restored the last couple of lines from
ocaml-3.00/byterun/floats.c:
This change works for me and the compiler bootstraps successfully.

Yes, I wrongly assumed that all versions of FreeBSD in current use
were already in "non trapping" floating-point mode at start-up.
You and Jacques Garrigue proved me wrong.

In the working sources, Jacques resurrected the IEEE initialization
for FreeBSD, and I also made sure that the initialization of the
standard library no longer causes special numbers (infinities, NaN) to
be loaded by the floating-point unit. So, this problem should be
fixed for good.

Cheers,

  • Xavier Leroy

@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant