This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
potental fp const fold problem
- To: egcs at cygnus dot com
- Subject: potental fp const fold problem
- From: Richard Henderson <rth at twiddle dot rth dot home>
- Date: Sat, 27 Jun 1998 11:58:21 -0700
- Cc: drepper at cygnus dot com
- Reply-To: Richard Henderson <rth at cygnus dot com>
Gcc will optimize
static const double zero = 0.0;
double foo() { return zero/zero; }
to
double foo() { return NAN; }
The problem with this is that the IEEE invalid operation exception
summary bit does not get set as it would if the division had been
performed.
While browsing fold-const.c though, I found
/* In IEEE floating point, x*1 is not equivalent to x for snans.
However, ANSI says we can drop signals,
so we can do this anyway. */
So does this mean that the transformation was legal? If so the
bug is in glibc (or its test suite), so it would be nice if someone
could clarify this.
r~