Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: fea@ornl.gov (James D. Freels)
Subject: floating point exceptions: Linux kernel feature or bug?
Date: 1998/05/03	[thread overview]
Message-ID: <v1sk9835r5b.fsf@fea.rrd.ornl.gov> (raw)


Colleagues:

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 generate 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 follwing 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 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 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.

test.f:
___________________________________________________________
      program test
c
c     program to test g77 on i386 and alpha
c
      x=1.0
      y=0.0
      z=2.0

      a=x/z
      write(*,*)x,z,a

      b=x/y
      write(*,*)x,y,b

      end
____________________________________________________________



             reply	other threads:[~1998-05-03  4:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-03  4:00 James D. Freels [this message]
1998-05-03  4:00 ` floating point exceptions: Linux kernel feature or bug? Gerald A. Feldman
1998-05-04  4:00   ` Michal Jaegermann
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox