This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/37449] [4.4 Regression] calculix gets wrong answer for -O1 -ffast-math
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Oct 2008 17:35:21 -0000
- Subject: [Bug tree-optimization/37449] [4.4 Regression] calculix gets wrong answer for -O1 -ffast-math
- References: <bug-37449-4503@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #13 from jakub at gcc dot gnu dot org 2008-10-14 17:35 -------
The different results between -O1 -f{,no}unsafe-math-optimizations are because
this testcase relies heavily on signed zeros, and with with fast math 0 and -0
aren't considered to make a difference, you get at least different value of tt
depending on it (for cn -1.0 it can be either pi/3 or -pi/3, depending on
whether
sqrt returned -0 or 0). But no matter whether tt is pi/3 or -pi/3, two of the
results should be 0.5 and so the test should succeed. But dom1 when it decides
to duplicate the bb's (once for the passed in cn, once for +-1.0) omits
unexpectedly the first conditional (i.e. set *neig = 2 if fabs (al[0] - al[1])
< 1.e-5). It does that both when -funsafe-math-optimizations and
-fno-unsafe-math-optimizations, but given that for -funsafe-math-optimizations
tt is -pi/3, al[0] is 0.5 and al[1] is 0.5, so this is fatal, while for
non-fast math al[0] is 0.5 and al[2] is 0.5, so it doesn't care.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37449