This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
One more limits question
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc at gcc dot gnu dot org, gdr at integrable-solutions dot net, rth at redhat dot com
- Date: Wed, 29 Jan 2003 12:39:48 -0800
- Subject: One more limits question
- Reply-to: mark at codesourcery dot com
I'll try not to open such a huge can of worms this time. :-)
I'm trying to figure out how this code works.
static const bool has_quiet_NaN
= __builtin_nanf ("") != __builtin_nanf ("");
The constant-folding machinery seems to always consider this
expression to evaluate to true, due to this code in fold:
/* If either operand is a NaN, the result is false with two
exceptions: First, an NE_EXPR is true on NaNs, but that case
is already handled correctly since we will be inverting the
result for NE_EXPR. Second, if we had inverted a LE_EXPR
or a GE_EXPR into a LT_EXPR, we must return true so that it
will be inverted into false. */
if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg0))
|| REAL_VALUE_ISNAN (TREE_REAL_CST (arg1)))
t1 = build_int_2 (invert && code == LT_EXPR, 0);
So I'm trying to figure out why this isn't just:
// We don't yet have a way of computing this correctly.
static const bool has_quiet_NaN = true;
I'm sure I'm being dense; lay it on me.
Thanks,
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com