summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2015-08-24 23:44:44 (GMT)
committerLarry Hastings <larry@hastings.org>2015-08-24 23:44:44 (GMT)
commit8bf6b06c9dec1a45a7f343f8fbc905d89424fe15 (patch)
tree896648c763a1a905f851b4ee87c1eecc0d19cb2a
parentd5b129c9a1dc005f87df26c10f2d77ca018f7f31 (diff)
parent803502c56b1ead3a59ae0d203ebfa6869dc13fb0 (diff)
downloadcpython-8bf6b06c9dec1a45a7f343f8fbc905d89424fe15.zip
cpython-8bf6b06c9dec1a45a7f343f8fbc905d89424fe15.tar.gz
cpython-8bf6b06c9dec1a45a7f343f8fbc905d89424fe15.tar.bz2
Merged in bitdancer/cpython350 (pull request #4)
#21167: Fix definition of NAN when ICC used without -fp-model strict.
-rw-r--r--Include/pymath.h24
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS3
3 files changed, 27 insertions, 1 deletions
diff --git a/Include/pymath.h b/Include/pymath.h
index 62a6c42..1ea9ac1 100644
--- a/Include/pymath.h
+++ b/Include/pymath.h
@@ -150,7 +150,29 @@ PyAPI_FUNC(void) _Py_set_387controlword(unsigned short);
* doesn't support NaNs.
*/
#if !defined(Py_NAN) && !defined(Py_NO_NAN)
-#define Py_NAN (Py_HUGE_VAL * 0.)
+#if !defined(__INTEL_COMPILER)
+ #define Py_NAN (Py_HUGE_VAL * 0.)
+#else /* __INTEL_COMPILER */
+ #if defined(ICC_NAN_STRICT)
+ #pragma float_control(push)
+ #pragma float_control(precise, on)
+ #pragma float_control(except, on)
+ #if defined(_MSC_VER)
+ __declspec(noinline)
+ #else /* Linux */
+ __attribute__((noinline))
+ #endif /* _MSC_VER */
+ static double __icc_nan()
+ {
+ return sqrt(-1.0);
+ }
+ #pragma float_control (pop)
+ #define Py_NAN __icc_nan()
+ #else /* ICC_NAN_RELAXED as default for Intel Compiler */
+ static union { unsigned char buf[8]; double __icc_nan; } __nan_store = {0,0,0,0,0,0,0xf8,0x7f};
+ #define Py_NAN (__nan_store.__icc_nan)
+ #endif /* ICC_NAN_STRICT */
+#endif /* __INTEL_COMPILER */
#endif
/* Py_OVERFLOWED(X)
diff --git a/Misc/ACKS b/Misc/ACKS
index e2e8387..c2386e8 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -594,6 +594,7 @@ Gregor Hoffleit
Chris Hoffman
Stefan Hoffmeister
Albert Hofkamp
+Chris Hogan
Tomas Hoger
Jonathan Hogg
Kamilla Holanda
diff --git a/Misc/NEWS b/Misc/NEWS
index 27a0564..459bacc 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ Release date: 2015-08-23
Core and Builtins
-----------------
+- Issue #21167: NAN operations are now handled correctly when python is
+ compiled with ICC even if -fp-model strict is not specified.
+
Library
-------