This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Strange SIGFPE (underflow?) with gfortran


Hi,

I'm using GCC 4.1.2, from SVN as of about two weeks
ago. It's on an AlphaServer system with Linux
installed.


I have this piece of Fortran code:

	      R1=-708.397
	      R2=EXP(R1)
	      R3=1-R2

Compiling with gfortran is OK. However, when running
the executable, I get an SIGFPE Arithmetic exception
at the line with the R3 assignment. Using gdb, I get
these values:

  R1 = -708.39697265625
  R2 = 2.2238412332569656e-308
  R3 = 0

The value of R3 should be 1, as R2 is close to zero.
I suppose the FPE is an underflow exception, but
why is the underflow not squashed to zero?


However, when I change the first line to
	      R1=708.396

(change last digit from 7 to 6) then the SIGFPE
disappears when running the executable. In that
case I have (using gdb):

  R1 = -708.39599609375
  R2 = 2.2260140139667223e-308
  R3 = 1


Is this a problem with the gfortran compiler?

Is there a flag I can pass during compilation
and/or linking, to avoid such problems?

Thank you,
Rob.



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]