summaryrefslogtreecommitdiff
path: root/include/my_global.h
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@sun.com>2009-03-24 11:26:22 +0300
committerAlexey Kopytov <Alexey.Kopytov@sun.com>2009-03-24 11:26:22 +0300
commitbbe24f03f2288049b39359ad52b0cccc1b762b44 (patch)
tree12d22303b90070d975a188c65c473b869ba8b14b /include/my_global.h
parent4568152518d075ec543bcc55b77241e4a5bf7c17 (diff)
downloadmariadb-git-bbe24f03f2288049b39359ad52b0cccc1b762b44.tar.gz
Fix for bug #42965: isinf() on 32bit x86 with gcc 4.3 can
produce incorrect results for ROUND() Added a workaround and a configure check to test whether isinf() is affected by the GCC bug #39228. Since no code in MySQL server is currently affected by that bug, the patch is actually a safeguard for possible future code modifications. No test cases or changelog entries are needed. configure.in: Added a configure check to test whether isinf() is safe to use in C code. include/my_global.h: Added a workaround for GCC bug #39228.
Diffstat (limited to 'include/my_global.h')
-rw-r--r--include/my_global.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 845ae042a42..7712696f633 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -797,9 +797,19 @@ 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
+/* 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