Changeset: 93619dd182a2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=93619dd182a2
Modified Files:
        NT/monetdb_config.h.in
        gdk/gdk_atoms.c
        gdk/gdk_atoms.h
        gdk/gdk_utils.c
Branch: Mar2018
Log Message:

We have serious problems using NAN with the Intel compiler on Windows.
Work around the problems.


diffs (91 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -71,6 +71,12 @@
 
 #define NATIVE_WIN32 1
 
+#ifdef __INTEL_COMPILER
+/* Definition of NAN is seriously broken on Intel compiler (at least
+ * in some versions), so we work around it. */
+#define NAN_CANNOT_BE_USED_AS_INITIALIZER
+#endif
+
 /* Define if building universal (internal helper macro) */
 /* #undef AC_APPLE_UNIVERSAL_BUILD */
 
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -239,11 +239,15 @@ ATOMisdescendant(int tpe, int parent)
 const bte bte_nil = GDK_bte_min-1;
 const sht sht_nil = GDK_sht_min-1;
 const int int_nil = GDK_int_min-1;
-#ifdef __INTEL_COMPILER
-/* stupid Intel compiler uses a value that cannot be used in an
- * initializer for NAN, so we have to initialize at run time */
-flt flt_nil;
-dbl dbl_nil;
+#ifdef NAN_CANNOT_BE_USED_AS_INITIALIZER
+/* Definition of NAN is seriously broken on Intel compiler (at least
+ * in some versions), so we work around it. */
+const union _flt_nil_t _flt_nil_ = {
+       UINT32_C(0x7fc00000)
+};
+const union _dbl_nil_t _dbl_nil_ = {
+       UINT64_C(0x7ff8000000000000)
+};
 #else
 const flt flt_nil = NAN;
 const dbl dbl_nil = NAN;
diff --git a/gdk/gdk_atoms.h b/gdk/gdk_atoms.h
--- a/gdk/gdk_atoms.h
+++ b/gdk/gdk_atoms.h
@@ -106,15 +106,23 @@ gdk_export size_t escapedStr(char *restr
 gdk_export const bte bte_nil;
 gdk_export const sht sht_nil;
 gdk_export const int int_nil;
-#ifdef __INTEL_COMPILER
-/* stupid Intel compiler uses a value that cannot be used in an
- * initializer for NAN, so we have to initialize at run time */
-#define NANCONST
+#ifdef NAN_CANNOT_BE_USED_AS_INITIALIZER
+/* Definition of NAN is seriously broken on Intel compiler (at least
+ * in some versions), so we work around it. */
+gdk_export const union _flt_nil_t {
+       uint32_t l;
+       flt f;
+} _flt_nil_;
+#define flt_nil (_flt_nil_.f)
+gdk_export const union _dbl_nil_t {
+       uint64_t l;
+       dbl d;
+} _dbl_nil_;
+#define dbl_nil (_dbl_nil_.d)
 #else
-#define NANCONST const
+gdk_export const flt flt_nil;
+gdk_export const dbl dbl_nil;
 #endif
-gdk_export NANCONST flt flt_nil;
-gdk_export NANCONST dbl dbl_nil;
 gdk_export const lng lng_nil;
 #ifdef HAVE_HGE
 gdk_export const hge hge_nil;
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -450,13 +450,6 @@ GDKinit(opt *set, int setlen)
        assert(sizeof(size_t) == SIZEOF_SIZE_T);
        assert(SIZEOF_OID == SIZEOF_INT || SIZEOF_OID == SIZEOF_LNG);
 
-#ifdef __INTEL_COMPILER
-       /* stupid Intel compiler uses a value that cannot be used in an
-        * initializer for NAN, so we have to initialize at run time */
-       flt_nil = NAN;
-       dbl_nil = NAN;
-#endif
-
 #ifdef NEED_MT_LOCK_INIT
        MT_lock_init(&MT_system_lock,"MT_system_lock");
        ATOMIC_INIT(GDKstoppedLock);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to