[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

floating point exceptions: Linux kernel feature or bug?


I have a problem with floating-point error on the DEC-Alpha under
Linux.  I have on a single machine installed on separate disks: (1)
DEC-Unix v4.0b with DEC FORTRAN, (2) Microsoft Windows NT 4, and (3)
Linux 2.0.30 and later kernels (2.0.33, 2.1.9x, etc.).  On the Linux
disk, I have partitioned a RedHat 5.0 and Debian 2.0 (hamm unreleased)
distributions.  All are working correctly except for this
floating-point problem I am about to describe.

On the DEC-Alpha, a FORTRAN (or any other type of compiler) compiled
code that is linked with the -non_shared option will create a
statically linked executable.  This executable can be copied to the
Linux partition (via second machine and reboot since direct
disk-2-disk copies are not possible?) and executed directly.  This
seems to work for me except in the case where a floating overflow or
divide by zero occurs on the Linux operating system.

I need to be able to tolerate such poor coding practices because the
FORTRAN code I use is in a production mode, is very large and
developed over many years by many people, and would take too long and
be too costly to correct.   Hence, I compile the code with DEC-FORTRAN
using the -fpe1 or -fpe2 options which generates an executable that
will allow for divide by zero or floating overflows to occur.
However, when I execute the same code under Linux, I immediately get a
"forrtl: floating exception (75)" error and the code does a core dump
and halts.  For many reasons, I would prefer to perform these
production runs (with very few recompiles) under Linux, but currently
I cannot do this.

I can best illustrate the problem with a very simple test code that is
attached to the end of this mailing.  When compiled and executed with
default swithes on the following machines/compilers, the code execution
continues to a normal completion except under Linux where the code
halts with core dump.  Note that the first entry is under Intel-Linux
using the g77 compiler which gives the desired result.

Machine        OS            compiler        output for divide by zero

Pentium        Linux         g77 (egcs)      infinity

RS/6K          AIX           xlf             infinity

SGI            Irix          f77             infinity

Alpha          DEC-Unix      f77             infinity

Alpha          Linux         g77 (egcs)      core dump and halt

Alpha          Linux         f77 (DEC Unix)  core dump and halt

My questions are: (1) Is there a kernel configuration switch I can set
to allow the Linux kernel to tolerate divide by zero and hence run
correctly? (2) If not, is this therefore a Linux-Alpha kernel bug
(note the Intel g77 compiler allows the divide by zero)? (3) Is there
anything else I can do that will allow a divide by zero (run-time
libraries, etc.)?  (4) Have other people experienced this problem and
found a workaround?

Thanks for any help and feel free to e-mail me directly rather than
via the newsgroups and/or mailing lists.

      program test
c     program to test g77 on i386 and alpha



|James D. Freels, P.E._i, Ph.D. |Phone:  (423)576-8645 |   | L | A |
|Oak Ridge National Laboratory  |FAX:    (423)574-9172 | H | I | L |
|Research Reactors Division     |work e-m: fea@ornl.gov| F | N | P |
|P. O. Box 2008                 |home e-m: fea@icx.net | I | U | H |
|Oak Ridge, Tennessee 37831-6392|world's best neutrons | R | X | A |

To UNSUBSCRIBE, email to debian-alpha-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: