Floating point emulator bug?

Pim Zandbergen pim at cti-software.nl
Fri Jan 12 03:17:46 AEST 1990


Consider the following program:

main()
{
    double           a = 2147483648.0;
    unsigned long    b;

    b = (unsigned long) a;	/* core dump here */
    printf("b = %lu\n", b);
}

Looks quite legal to me, but it will core dump with a floating
point exception when compiled for Unix 386 and Xenix 386

I have used gcc 1.36, ISC's pcc, and SCO Xenix 2.2.3 compilers.
I have run the programs on ISC 386/ix 2.0.1 and SCO Xenix 386 2.3.1.
The only working program was produced by the Xenix 286 compiler.
It will also work on an AT&T 3B2 (with a Math Acceleration Unit)

I suspect it is a bug in the floating point emulator. Maybe
the 286 emulator does its own floating point emulation.

I do not have a 80387 around to see if this will help.
If some kind soul would want to run this program on either
ISC or SCO with a 80387 and mail me the result,
I'd be grateful eternally.

Be warned, one volunteer with SCO Xenix 2.3.2 had his compiler crashed.
-- 
Pim Zandbergen                           domain : pim at cti-software.nl
CTI Software BV                          uucp   : uunet!mcsun!hp4nl!ctisbv!pim
Laan Copes van Cattenburch 70            phone  : +31 70 3542302
2585 GD The Hague, The Netherlands       fax    : +31 70 3512837



More information about the Comp.unix.i386 mailing list