]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* acinclude.m4 (LIBGFOR_CHECK_FOR_BROKEN_ISFINITE,
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Sep 2010 18:47:11 +0000 (18:47 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Sep 2010 18:47:11 +0000 (18:47 +0000)
LIBGFOR_CHECK_FOR_BROKEN_ISNAN,
LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY): Remove.
* configure.ac: Remove above checks.
* libgfortran.h: Define isnan, isinf, isfinite, isnormal and
signbit in terms of the respective built-ins.
* io/write_float.def (WRITE_FLOAT): Use signbit() instead of
__builtin_signbit().
* intrinsics/c99_functions.c (tgamma): Use isnan() instead of
__builtin_isnan().
* config.h.in: Regenerate.
* configure: Regenerate.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164119 138bc75d-0d04-0410-961f-82ee72b054a4

libgfortran/ChangeLog
libgfortran/acinclude.m4
libgfortran/config.h.in
libgfortran/configure
libgfortran/configure.ac
libgfortran/intrinsics/c99_functions.c
libgfortran/io/write_float.def
libgfortran/libgfortran.h

index e21064ecfde2008886d3776f3eeb0b55472abf8e..913c0e56bb7972ac9f3b1b70eacedfc7e93c1dfe 100644 (file)
@@ -1,3 +1,18 @@
+2010-09-09  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       * acinclude.m4 (LIBGFOR_CHECK_FOR_BROKEN_ISFINITE,
+       LIBGFOR_CHECK_FOR_BROKEN_ISNAN,
+       LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY): Remove.
+       * configure.ac: Remove above checks.
+       * libgfortran.h: Define isnan, isinf, isfinite, isnormal and
+       signbit in terms of the respective built-ins.
+       * io/write_float.def (WRITE_FLOAT): Use signbit() instead of
+       __builtin_signbit().
+       * intrinsics/c99_functions.c (tgamma): Use isnan() instead of
+       __builtin_isnan().
+       * config.h.in: Regenerate.
+       * configure: Regenerate.
+
 2010-09-06  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/38282
index 33552871001e9e246b8c57fdba06548ec7e6e9c3..09cd29213cea178fb962eb23fe8884ec1506be43 100644 (file)
@@ -196,119 +196,6 @@ if test x"$libgfor_cv_have_crlf" = xyes; then
   AC_DEFINE(HAVE_CRLF, 1, [Define if CRLF is line terminator.])
 fi])
 
-dnl Check whether isfinite is broken.
-dnl The most common problem is that it does not work on long doubles.
-AC_DEFUN([LIBGFOR_CHECK_FOR_BROKEN_ISFINITE], [
-  AC_CACHE_CHECK([whether isfinite is broken],
-                  libgfor_cv_have_broken_isfinite, [
-  libgfor_check_for_broken_isfinite_save_LIBS=$LIBS
-  LIBS="$LIBS -lm"
-  AC_TRY_RUN([
-#include <math.h>
-#include <float.h>
-int main ()
-{
-#ifdef isfinite
-#ifdef LDBL_MAX
-  if (!isfinite(LDBL_MAX)) return 1;
-#endif
-#ifdef DBL_MAX
-  if (!isfinite(DBL_MAX)) return 1;
-#endif
-#endif
-return 0;
-}], libgfor_cv_have_broken_isfinite=no, libgfor_cv_have_broken_isfinite=yes, [
-case "${target}" in
-  hppa*-*-hpux*) libgfor_cv_have_broken_isfinite=yes ;;
-  *) libgfor_cv_have_broken_isfinite=no ;;
-esac])]
-  LIBS=$libgfor_check_for_broken_isfinite_save_LIBS)
-if test x"$libgfor_cv_have_broken_isfinite" = xyes; then
-  AC_DEFINE(HAVE_BROKEN_ISFINITE, 1, [Define if isfinite is broken.])
-fi])
-
-dnl Check whether isnan is broken.
-dnl The most common problem is that it does not work on long doubles.
-AC_DEFUN([LIBGFOR_CHECK_FOR_BROKEN_ISNAN], [
-  AC_CACHE_CHECK([whether isnan is broken],
-                  libgfor_cv_have_broken_isnan, [
-  libgfor_check_for_broken_isnan_save_LIBS=$LIBS
-  LIBS="$LIBS -lm"
-  AC_TRY_RUN([
-#include <math.h>
-#include <float.h>
-int main ()
-{
-#ifdef isnan
-#ifdef LDBL_MAX
-  {
-    long double x;
-    x = __builtin_nanl ("");
-    if (!isnan(x)) return 1;
-    if (isnan(LDBL_MAX)) return 1;
-#ifdef NAN
-    x = (long double) NAN;
-    if (!isnan(x)) return 1;
-#endif
-  }
-#endif
-#ifdef DBL_MAX
-  {
-    double y;
-    y = __builtin_nan ("");
-    if (!isnan(y)) return 1;
-    if (isnan(DBL_MAX)) return 1;
-#ifdef NAN
-    y = (double) NAN;
-    if (!isnan(y)) return 1;
-#endif
-  }
-#endif
-#endif
-return 0;
-}], libgfor_cv_have_broken_isnan=no, libgfor_cv_have_broken_isnan=yes, [
-case "${target}" in
-  hppa*-*-hpux*) libgfor_cv_have_broken_isnan=yes ;;
-  *) libgfor_cv_have_broken_isnan=no ;;
-esac])]
-  LIBS=$libgfor_check_for_broken_isnan_save_LIBS)
-if test x"$libgfor_cv_have_broken_isnan" = xyes; then
-  AC_DEFINE(HAVE_BROKEN_ISNAN, 1, [Define if isnan is broken.])
-fi])
-
-dnl Check whether fpclassify is broken.
-dnl The most common problem is that it does not work on long doubles.
-AC_DEFUN([LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY], [
-  AC_CACHE_CHECK([whether fpclassify is broken],
-                  libgfor_cv_have_broken_fpclassify, [
-  libgfor_check_for_broken_fpclassify_save_LIBS=$LIBS
-  LIBS="$LIBS -lm"
-  AC_TRY_RUN([
-#include <math.h>
-#include <float.h>
-int main ()
-{
-#ifdef fpclassify
-#ifdef LDBL_MAX
-        if (fpclassify(LDBL_MAX) == FP_NAN
-            || fpclassify(LDBL_MAX) == FP_INFINITE) return 1;
-#endif
-#ifdef DBL_MAX
-        if (fpclassify(DBL_MAX) == FP_NAN
-            || fpclassify(DBL_MAX) == FP_INFINITE) return 1;
-#endif
-#endif
-return 0;
-}], libgfor_cv_have_broken_fpclassify=no, libgfor_cv_have_broken_fpclassify=yes, [
-case "${target}" in
-  hppa*-*-hpux*) libgfor_cv_have_broken_fpclassify=yes ;;
-  *) libgfor_cv_have_broken_fpclassify=no ;;
-esac])]
-  LIBS=$libgfor_check_for_broken_fpclassify_save_LIBS)
-if test x"$libgfor_cv_have_broken_fpclassify" = xyes; then
-  AC_DEFINE(HAVE_BROKEN_FPCLASSIFY, 1, [Define if fpclassify is broken.])
-fi])
-
 dnl Check whether the st_ino and st_dev stat fields taken together uniquely
 dnl identify the file within the system. This is should be true for POSIX
 dnl systems; it is known to be false on mingw32.
index bdf3b4ac49f228371df5b447a9c9a618cda2c037..f5f367fd2366531e724b3fd69a1855e57a825ac6 100644 (file)
 /* Define to 1 if you have the `backtrace_symbols' function. */
 #undef HAVE_BACKTRACE_SYMBOLS
 
-/* Define if fpclassify is broken. */
-#undef HAVE_BROKEN_FPCLASSIFY
-
-/* Define if isfinite is broken. */
-#undef HAVE_BROKEN_ISFINITE
-
-/* Define if isnan is broken. */
-#undef HAVE_BROKEN_ISNAN
-
 /* Define if powf is broken. */
 #undef HAVE_BROKEN_POWF
 
index bc4a25bf70e450e166462d914c6e336a0384477f..cf2b58748dcb5b46ec4cbd8ba4dc1e50012dfe10 100755 (executable)
@@ -24162,188 +24162,6 @@ $as_echo "#define HAVE_CLOG 1" >>confdefs.h
 fi
 
 
-# Check for a isfinite macro that works on long doubles.
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isfinite is broken" >&5
-$as_echo_n "checking whether isfinite is broken... " >&6; }
-if test "${libgfor_cv_have_broken_isfinite+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-
-  libgfor_check_for_broken_isfinite_save_LIBS=$LIBS
-  LIBS="$LIBS -lm"
-  if test "$cross_compiling" = yes; then :
-
-case "${target}" in
-  hppa*-*-hpux*) libgfor_cv_have_broken_isfinite=yes ;;
-  *) libgfor_cv_have_broken_isfinite=no ;;
-esac
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <math.h>
-#include <float.h>
-int main ()
-{
-#ifdef isfinite
-#ifdef LDBL_MAX
-  if (!isfinite(LDBL_MAX)) return 1;
-#endif
-#ifdef DBL_MAX
-  if (!isfinite(DBL_MAX)) return 1;
-#endif
-#endif
-return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  libgfor_cv_have_broken_isfinite=no
-else
-  libgfor_cv_have_broken_isfinite=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-  LIBS=$libgfor_check_for_broken_isfinite_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgfor_cv_have_broken_isfinite" >&5
-$as_echo "$libgfor_cv_have_broken_isfinite" >&6; }
-if test x"$libgfor_cv_have_broken_isfinite" = xyes; then
-
-$as_echo "#define HAVE_BROKEN_ISFINITE 1" >>confdefs.h
-
-fi
-
-# Check for a isnan macro that works on long doubles.
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether isnan is broken" >&5
-$as_echo_n "checking whether isnan is broken... " >&6; }
-if test "${libgfor_cv_have_broken_isnan+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-
-  libgfor_check_for_broken_isnan_save_LIBS=$LIBS
-  LIBS="$LIBS -lm"
-  if test "$cross_compiling" = yes; then :
-
-case "${target}" in
-  hppa*-*-hpux*) libgfor_cv_have_broken_isnan=yes ;;
-  *) libgfor_cv_have_broken_isnan=no ;;
-esac
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <math.h>
-#include <float.h>
-int main ()
-{
-#ifdef isnan
-#ifdef LDBL_MAX
-  {
-    long double x;
-    x = __builtin_nanl ("");
-    if (!isnan(x)) return 1;
-    if (isnan(LDBL_MAX)) return 1;
-#ifdef NAN
-    x = (long double) NAN;
-    if (!isnan(x)) return 1;
-#endif
-  }
-#endif
-#ifdef DBL_MAX
-  {
-    double y;
-    y = __builtin_nan ("");
-    if (!isnan(y)) return 1;
-    if (isnan(DBL_MAX)) return 1;
-#ifdef NAN
-    y = (double) NAN;
-    if (!isnan(y)) return 1;
-#endif
-  }
-#endif
-#endif
-return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  libgfor_cv_have_broken_isnan=no
-else
-  libgfor_cv_have_broken_isnan=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-  LIBS=$libgfor_check_for_broken_isnan_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgfor_cv_have_broken_isnan" >&5
-$as_echo "$libgfor_cv_have_broken_isnan" >&6; }
-if test x"$libgfor_cv_have_broken_isnan" = xyes; then
-
-$as_echo "#define HAVE_BROKEN_ISNAN 1" >>confdefs.h
-
-fi
-
-# Check for a fpclassify macro that works on long doubles.
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fpclassify is broken" >&5
-$as_echo_n "checking whether fpclassify is broken... " >&6; }
-if test "${libgfor_cv_have_broken_fpclassify+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-
-  libgfor_check_for_broken_fpclassify_save_LIBS=$LIBS
-  LIBS="$LIBS -lm"
-  if test "$cross_compiling" = yes; then :
-
-case "${target}" in
-  hppa*-*-hpux*) libgfor_cv_have_broken_fpclassify=yes ;;
-  *) libgfor_cv_have_broken_fpclassify=no ;;
-esac
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <math.h>
-#include <float.h>
-int main ()
-{
-#ifdef fpclassify
-#ifdef LDBL_MAX
-        if (fpclassify(LDBL_MAX) == FP_NAN
-            || fpclassify(LDBL_MAX) == FP_INFINITE) return 1;
-#endif
-#ifdef DBL_MAX
-        if (fpclassify(DBL_MAX) == FP_NAN
-            || fpclassify(DBL_MAX) == FP_INFINITE) return 1;
-#endif
-#endif
-return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  libgfor_cv_have_broken_fpclassify=no
-else
-  libgfor_cv_have_broken_fpclassify=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-  LIBS=$libgfor_check_for_broken_fpclassify_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgfor_cv_have_broken_fpclassify" >&5
-$as_echo "$libgfor_cv_have_broken_fpclassify" >&6; }
-if test x"$libgfor_cv_have_broken_fpclassify" = xyes; then
-
-$as_echo "#define HAVE_BROKEN_FPCLASSIFY 1" >>confdefs.h
-
-fi
-
 # Check whether the system has a working stat()
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target stat is reliable" >&5
index 8b9ac74c16a884786f85fcbf6215394bdaebff3e..e5517a19587a9f828599c269feef180dad737232 100644 (file)
@@ -450,15 +450,6 @@ AC_CHECK_LIB([m],[catanl],[AC_DEFINE([HAVE_CATANL],[1],[libm includes catanl])])
 # On AIX, clog is present in libm as __clog
 AC_CHECK_LIB([m],[__clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])])
 
-# Check for a isfinite macro that works on long doubles.
-LIBGFOR_CHECK_FOR_BROKEN_ISFINITE
-
-# Check for a isnan macro that works on long doubles.
-LIBGFOR_CHECK_FOR_BROKEN_ISNAN
-
-# Check for a fpclassify macro that works on long doubles.
-LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY
-
 # Check whether the system has a working stat()
 LIBGFOR_CHECK_WORKING_STAT
 
index 03bcbfedaa642de6c3633115979f5282b602ef10..20fc7e00edb45f0c49f7855e60e66e78fcf09da0 100644 (file)
@@ -558,7 +558,6 @@ powf (float x, float y)
 }
 #endif
 
-/* Note that if fpclassify is not defined, then NaN is not handled */
 
 /* Algorithm by Steven G. Kargl.  */
 
@@ -1854,7 +1853,7 @@ tgamma (double x)
   n = 0;
   y = x;
 
-  if (__builtin_isnan (x))
+  if (isnan (x))
     return x;
 
   if (y <= 0)
index 776e59119931f07943af8787c1dd751bd60a7359..b9157dfdcebf29b3298334a0e4927d01ade005cf 100644 (file)
@@ -977,7 +977,7 @@ sprintf (buffer, "%+-#" STR(MIN_FIELD_WIDTH) ".*" \
 {\
        GFC_REAL_ ## x tmp;\
        tmp = * (GFC_REAL_ ## x *)source;\
-       sign_bit = __builtin_signbit (tmp);\
+       sign_bit = signbit (tmp);\
        if (!isfinite (tmp))\
          { \
            write_infnan (dtp, f, isnan (tmp), sign_bit);\
index 99f7342958fd136fc14dd2395f44692c3902a312..8c08c7b3e9f5746c34d5d664bc80f442ca847163 100644 (file)
@@ -221,42 +221,24 @@ extern int __mingw_snprintf (char *, size_t, const char *, ...)
 #define offsetof(TYPE, MEMBER)  ((size_t) &((TYPE *) 0)->MEMBER)
 #endif
 
-/* The isfinite macro is only available with C99, but some non-C99
-   systems still provide fpclassify, and there is a `finite' function
-   in BSD.
+/* The C99 classification macros isfinite, isinf, isnan, isnormal
+   and signbit are broken or inconsistent on quite a few targets.
+   So, we use GCC's builtins instead.
 
-   Also, isfinite is broken on Cygwin.
+   Another advantage for GCC's builtins for these type-generic macros
+   is that it handles floating-point types that the system headers
+   may not support (like __float128).  */
 
-   When isfinite is not available, try to use one of the
-   alternatives, or bail out.  */
-
-#if defined(HAVE_BROKEN_ISFINITE) || defined(__CYGWIN__)
-#undef isfinite
-#endif
-
-#if defined(HAVE_BROKEN_ISNAN)
 #undef isnan
-#endif
-
-#if defined(HAVE_BROKEN_FPCLASSIFY)
-#undef fpclassify
-#endif
-
-#if !defined(isfinite)
-#if !defined(fpclassify)
-#define isfinite(x) ((x) - (x) == 0)
-#else
-#define isfinite(x) (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
-#endif /* !defined(fpclassify) */
-#endif /* !defined(isfinite)  */
-
-#if !defined(isnan)
-#if !defined(fpclassify)
-#define isnan(x) ((x) != (x))
-#else
-#define isnan(x) (fpclassify(x) == FP_NAN)
-#endif /* !defined(fpclassify) */
-#endif /* !defined(isfinite)  */
+#define isnan(x) __builtin_isnan(x)
+#undef isfinite
+#define isfinite(x) __builtin_isfinite(x)
+#undef isinf
+#define isinf(x) __builtin_isinf(x)
+#undef isnormal
+#define isnormal(x) __builtin_isnormal(x)
+#undef signbit
+#define signbit(x) __builtin_signbit(x)
 
 /* TODO: find the C99 version of these an move into above ifdef.  */
 #define REALPART(z) (__real__(z))