[Bug libfortran/30780] cpu_time produces a floating point exception when used with -O0

2007-02-13 Thread jvdelisle at gcc dot gnu dot org


--- Comment #7 from jvdelisle at gcc dot gnu dot org  2007-02-14 00:37 
---
OK, then there is a similar, not necessarily related problem in write.c.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30780



[Bug libfortran/30780] cpu_time produces a floating point exception when used with -O0

2007-02-12 Thread kargl at gcc dot gnu dot org


--- Comment #6 from kargl at gcc dot gnu dot org  2007-02-13 06:41 ---
(In reply to comment #5)

> The exception is occurring in the print statement. Nothing to do with time.
> 

No, there is a "problem" in cpu_time.  -ffpe-trap='precision' is
trapping on lost precision.  On x86_64, long is 64-bit and 
GFC_REAL_4 is 32-bit with only 24-bits of precision.  You can't
convert long to GFC_REAL_4 without loss of precision.  In short,
using this option is probably not a good idea if you have mixed
mode math.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30780



[Bug libfortran/30780] cpu_time produces a floating point exception when used with -O0

2007-02-12 Thread jvdelisle at gcc dot gnu dot org


--- Comment #5 from jvdelisle at gcc dot gnu dot org  2007-02-13 05:41 
---
I modified cpu_time_4 to just return some dummy values, and experimented a bit
with the test case.  When I commented out the print statement, the exception
went away.

Here is a reduced test case.

program test2
 real :: dog
 dog = 1.0
 print *, dog
end program test2   

The exception is occurring in the print statement. Nothing to do with time.

(gdb) r
Starting program: /home/jerry/prs/pr30780/a.out 

Program received signal SIGFPE, Arithmetic exception.
0x2ab2c3d9 in write_float (dtp=0x7fff52698b00, f=0x7fff52698a50, 
source=, len=)
at ../../../gcc43/libgfortran/io/write.c:366
366   if ((m > 0.0 && m < 0.1 - 0.05 / exp_d) || (m >= exp_d - 0.5 ) ||


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30780



[Bug libfortran/30780] cpu_time produces a floating point exception when used with -O0

2007-02-12 Thread pinskia at gcc dot gnu dot org


--- Comment #4 from pinskia at gcc dot gnu dot org  2007-02-13 04:32 ---
I have no idea how to fix this problem at the moment.

It is hard as there are no functions which convert from a floating point to an
integer that might not raise a signal.  This is why setting trapping on
precision is almost something you never want to do.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

  Component|fortran |libfortran


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30780