This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51535] Optimization problem with -finit-real=snan at -O1
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 14 Dec 2011 07:48:27 +0000
- Subject: [Bug fortran/51535] Optimization problem with -finit-real=snan at -O1
- Auto-submitted: auto-generated
- References: <bug-51535-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51535
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-14 07:48:27 UTC ---
The issue seems to be related to the excess precision of the x87 math unit. At
least, I do not see the issue with x86-86-linux with -m64. I do see it with
-m32 but only if I do not use -mfpmath=sse.
The reason that it disappears with -O2 is that the NaN assignment is optimized
way.
>From the dump (-fdump-tree-optimized-lineno):
p_h_usstd (real(kind=4) & restrict h)
...
[test.f90 : 7:0] sigma = Nan;
[test.f90 : 7:0] delta = Nan;
The backtrace shows that the exception occurs for line 7.