List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:March 25 2009 12:49pm
Subject:bzr commit into mysql-5.1-bugteam branch (Alexey.Kopytov:2824)
View as plain text  
#At file:///Users/kaa/src/bzr/bugteam/bug42965/my51-bug42965/ based on revid:joro@stripped

 2824 Alexey Kopytov	2009-03-25 [merge]
      Manual merge.
      modified:
        configure.in
        include/my_global.h

=== modified file 'configure.in'
--- a/configure.in	2009-03-20 11:18:29 +0000
+++ b/configure.in	2009-03-25 12:48:29 +0000
@@ -2085,6 +2085,27 @@ esac
 AC_MSG_CHECKING(for isinf in <math.h>)
 AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
   AC_MSG_RESULT(yes)
+  AC_MSG_CHECKING(whether isinf() is safe to use in C code)
+  AC_TRY_RUN([
+#include <math.h>
+int main()
+{
+  double a= 10.0;
+  double b= 1e308;
+
+  return !isinf(a * b);
+}
+],
+  [AC_MSG_RESULT(yes)],
+  [AC_MSG_RESULT(no)
+   AC_DEFINE([HAVE_BROKEN_ISINF], [1],
+             [Define to 1 if isinf() uses 80-bit register for intermediate values])
+  ],
+  [
+# Let's be optimistic when cross-compiling, since the only compiler known
+# to be affected by this isinf() bug is GCC 4.3 on 32-bit x86.
+   AC_MSG_RESULT([[cross-compiling, assuming 'yes']])
+  ])
   AC_MSG_CHECKING(whether isinf() can be used in C++ code)
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS

=== modified file 'include/my_global.h'
--- a/include/my_global.h	2009-02-25 08:39:28 +0000
+++ b/include/my_global.h	2009-03-25 12:48:29 +0000
@@ -905,10 +905,20 @@ typedef SOCKET_SIZE_TYPE size_socket;
 #endif
 
 #ifdef HAVE_ISINF
-/* isinf() can be used in both C and C++ code */
-#define my_isinf(X) isinf(X)
+/* Check if C compiler is affected by GCC bug #39228 */
+#if !defined(__cplusplus) && defined(HAVE_BROKEN_ISINF)
+/* Force store/reload of the argument to/from a 64-bit double */
+static inline double my_isinf(double x)
+{
+  volatile double t= x;
+  return isinf(t);
+}
 #else
-#define my_isinf(X) (!isfinite(X) && !isnan(X))
+/* System-provided isinf() is available and safe to use */
+#define my_isinf(X) isinf(X)
+#endif
+#else /* !HAVE_ISINF */
+#define my_isinf(X) (!finite(X) && !isnan(X))
 #endif
 
 /* Define missing math constants. */

Thread
bzr commit into mysql-5.1-bugteam branch (Alexey.Kopytov:2824)Alexey Kopytov25 Mar