------- Comment #2 from burnus at gcc dot gnu dot org  2009-01-12 16:39 -------
For quick reading, skip next part and continue below the * * *.
---------------
I think this applies still (at least partially) as libgfortran/config/fpu*.h's
set_cpu() still has the line. For GLIBC one finds:

/* glibc does never have a FE_DENORMAL.  */
  if (options.fpe & GFC_FPE_DENORMAL)
#ifdef FE_DENORMAL
    feenableexcept (FE_DENORMAL);
#else
    st_printf ("Fortran runtime warning: IEEE 'denormal number' "
               "exception not supported.\n");
#endif

NOTE: The FE_* are defined in the system's fenv.h file and POSIX (SUSv3) does
not specify FE_DENORMAL only: FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW
and FE_UNDERFLOW. And also on my system (glibc-devel-2.9-4.18) fenv.h does not
have FE_DENORMAL.

However, fpu-387.h has support for it:

  if (options.fpe & GFC_FPE_DENORMAL) cw &= ~_FPU_MASK_DM;
[...]
  if (has_sse())
[...]
      if (options.fpe & GFC_FPE_DENORMAL) cw_sse &= ~(_FPU_MASK_DM << 7);

Thus the question is whether for "linux (i686) release" the fpu-387.h should
have been applied instead?

 * * *

For the reported problem:

> gives the message "Fortran runtime warning: IEEE 'denormal number' exception 
> not supported" without the compiler option -ffpe-trap.

It does not make sense that the message is printed without -ffpe-trap=. I don't
see how this could happen (with the current code).

> The program directly crashed with a floating point exception

I some doubt that the FPE crash is related to denormal numbers as they are
usually handled gracefully and are not serious. Especially since the warning
explicitly states that they are not supported for trapping. For the crash it is
extremely unlikely that it happens while printing the warning message.

> I tried to find the error in the debugger kdbg, but before the first 
> executable statement was passed the program stopped with the floating point 
> error.

There is a serious lack of information here - for instance you are missing the
compiler options. Stab into the dark: You are not using by chance
-malign-double or -mno-align-double? If you do, please remove it! (If you
don't, don't use it.)

We need:
1. If possible a minimal program which shows the bug, seemingly something like
     print *, 'Hello World'
     end
   is enough if the crash happens before the actual program is executed
2. The exact command line used to compile the program
3. More information about the compiler, i.e. my 4.1 compiler shows:
     gcc version 4.1.3 20080612 (prerelease) (SUSE Linux)
     Target: x86_64-suse-linux
   What does yours show for "gfortran -v"?

And best is to update to a newer gfortran version. 4.1.x is pretty old and the
4.1.x series is no longer maintained. 4.3.x and the currently developed 4.4 are
maintained (and 4.2.x is still maintained for a couple of weeks). Thus it would
be best if you could update to 4.3.x or 4.4.

As Daniel mentioned: Build instruction and pre-build binaries are available at
http://gcc.gnu.org/wiki/GFortranBinaries


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED


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

Reply via email to