This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/26717] [4.2 Regression] gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK,
- From: "anlauf at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Mar 2006 08:06:42 -0000
- Subject: [Bug middle-end/26717] [4.2 Regression] gfortran: ICE at tree-complex.c:133 with -O -ffast-math in LAPACK,
- References: <bug-26717-6318@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from anlauf at gmx dot de 2006-03-17 08:06 -------
(In reply to comment #4)
> I will, however, suggest that you reconsider using --fast-math with gfortran.
> One of my codes works correctly without --fast-math, but it
> will generate NaN's with it. I have not tracked down the problem,
A fairly well-known case is complex division, where -ffast-math
assumes a reduced range of the variables so that no overflow
can occur. See the gcc option -fno-cx-limited-range for more
details.
Here's an example where -fno-cx-limited-range does not counter
the effect of -ffast-math and produces an NaN:
% cat gfc_complex_div.f90
program gfc_complex_div
implicit none
complex, parameter :: a = 1.e-30 * (1.0, 1.0)
print *, cx_div (a, a)
contains
function cx_div (a, b)
complex :: cx_div, a, b
cx_div = a / b
end function cx_div
end program gfc_complex_div
% gfc gfc_complex_div.f90 -O && ./a.out
( 1.000000 , 0.000000 )
% gfc gfc_complex_div.f90 -O -ffast-math && ./a.out
( NaN, NaN)
% gfc gfc_complex_div.f90 -O -ffast-math -fno-cx-limited-range && ./a.out
( NaN, NaN)
I think this used to work (with g77?), but it appears not to work any
longer.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26717