This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Right now, libgfortran.h provides a fallback implementation of isfinite() when it is not available from the system. This implementation has prototype "int isfinite (double)", which is wrong: isfinite is supposed to be a macro, accepting float, double and long double types. Attached patch fixes this problem, and removes the fallback use of finite(), which can only accept doubles. This patch fixes a problem with large real(16) numbers on solaris. It is regtested on sparc-solaris, and the only other platform where it could go wrong is cygwin, which i'll regtest this evening. OK for mainline and 4.0 (given that cygwin regtests correctly)? FX :ADDPATCH libgfortran:
Attachment:
isfinite.ChangeLog
Description: Binary data
Index: libgfortran/libgfortran.h =================================================================== RCS file: /cvsroot/gcc/gcc/libgfortran/libgfortran.h,v retrieving revision 1.27 diff -p -u -r1.27 libgfortran.h --- libgfortran/libgfortran.h 7 Jul 2005 22:07:53 -0000 1.27 +++ libgfortran/libgfortran.h 3 Aug 2005 14:15:49 -0000 @@ -179,17 +179,11 @@ typedef off_t gfc_offset; alternatives, or bail out. */ #if (!defined(isfinite) || defined(__CYGWIN__)) #undef isfinite -static inline int -isfinite (double x) -{ #if defined(fpclassify) - return (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE); -#elif defined(HAVE_FINITE) - return finite (x); +#define isfinite(x) (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE) #else -#error "libgfortran needs isfinite, fpclassify, or finite" +#define isfinite(x) (((x) == (x)) && ((2 * (x) != (x)) || ((x) == 0))) #endif -} #endif /* !defined(isfinite) */ /* TODO: find the C99 version of these an move into above ifdef. */
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |