This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug libfortran/21376] libfortran "E" output format causes FPE


------- Additional Comments From prw at ceiriog1 dot demon dot co dot uk  2005-05-04 17:28 -------
The problem occurred in a large finite element analysis code I developed.
The toplevel logic was written in C++, and this was linked to a venerable
public domain numerical analysis library in Fortran.  My testcase consists
of the following two files.  You only get a floating point exception
if IEEE floating point exceptions are enabled.  I don't know if it is possible
to do this from a pure Fortran program, but it is certainly possible to
do from C, and I find it important to do this in numerical codes so that
I can see errors where they occur rather than just propagating NaN's through
the program.


File "toplevel.c":

#include <fenv.h>

main()
{
  feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
  killer_();
}



File "killer.f":

        subroutine killer
        write(6,'(x,e10.4)') 1.0
        end

gcc -c toplevel.c
gfortran -c killer.f
gcc toplevel.o killer.o -lgfortran
./a.out




-- 


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


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