Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000325OCamlOCaml generalpublic2001-03-21 09:342001-03-27 05:04
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000325: installing 3.01 on FreeBSD 3.3 (i386)
DescriptionI 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 ()
0000003 0x8054c98 in caml_main ()
0000004 0x8049377 in main ()
0000005 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

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000546)
administrator (administrator)
2001-03-27 05:03

> 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 PR#309.

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
(0000547)
administrator (administrator)
2001-03-27 05:04

Extend fix to FreeBSD 3.x. JG 2000-03-27.
(0000548)
administrator (administrator)
2001-03-29 15:54

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


- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker