William M. (Mike) Miller wrote:

The definitions of isfinite() (and fpclassify(), on which isfinite() depends) from math.h are as follows:

#define fpclassify(x) \
(__extension__ ({__typeof__(x) __x = (x); \
(sizeof (__x) == sizeof (float)) ? __fpclassifyf(__x) : __fpclassifyd(__x);}))


#define isfinite(x) \
(__extension__ ({__typeof__(x) __x = (x); \
fpclassify(__x) != FP_INFINITE && fpclassify(__x) != FP_NAN;}))

In case anyone else is interested, Andrew Pinski on the newlib list came up with the diagnosis. The definition of isfinite() declares a local variable, __x, for the floating point value being examined and passes that in the call to the macro fpclassify(). fpclassify() declares its own local variable, __x, and initializes it with the macro argument. The expansion of this declaration in fpclassify() shows exactly what is going wrong:


    __typeof__(__x) __x = (__x);

In other words, fpclassify()'s __x is initialized to its own uninitialized value, not to the value passed to isfinite().

Presumably a fix will trickle down eventually. In the meantime, it's easy to fix locally if anyone else runs into the problem.

--
William M. (Mike) Miller | Edison Design Group, Inc.
[EMAIL PROTECTED]


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/



Reply via email to