summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-01-08 20:56:12 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-01-08 20:56:12 (GMT)
commit7faa297ea6144a08e3e2284d3065d502c2598a87 (patch)
tree3649e5e6a599f8ef27f9af0a78dd85fbcd0fdb58
parent19efec650d421d9f5c3d8baad6cedb54e935e8d5 (diff)
downloadhdf5-7faa297ea6144a08e3e2284d3065d502c2598a87.zip
hdf5-7faa297ea6144a08e3e2284d3065d502c2598a87.tar.gz
hdf5-7faa297ea6144a08e3e2284d3065d502c2598a87.tar.bz2
[svn-r9783] Purpose: Bug fix
Description: For HP-UX 11.00, the compiler generates 'floating exception' when converting 'long double' to most of integer types. Solution: Define a macro for all other systems except HP-UX 11.00. Hard set this macro to 'no' in config/hpux11.00 to skip this test for HP-UX 11.00. Platforms tested: modi4, kelgia, fuss
-rw-r--r--config/hpux11.006
-rw-r--r--config/irix5.x3
-rw-r--r--config/irix6.x5
-rwxr-xr-xconfigure34
-rw-r--r--configure.in39
-rw-r--r--src/H5config.h.in10
-rw-r--r--test/dtypes.c18
7 files changed, 85 insertions, 30 deletions
diff --git a/config/hpux11.00 b/config/hpux11.00
index 581daf9..0979b42 100644
--- a/config/hpux11.00
+++ b/config/hpux11.00
@@ -96,3 +96,9 @@ case "X-$CXX" in
PROFILE_CPPFLAGS=
;;
esac
+
+# Set flag to avoid conversion from 'long double' to integers because of
+# HP-UX's compiler problems. For HP-UX 11.00, the compiler has 'floating exception'
+# when converting 'long double' to all integers except 'unsigned long long'.
+# Other HP-UX systems are unknown yet. (1/8/05 - SLU)
+hdf5_cv_sw_ldouble_to_integer_works=${hdf5_cv_sw_ldouble_to_integer_works='no'}
diff --git a/config/irix5.x b/config/irix5.x
index 77b35c8..810b221 100644
--- a/config/irix5.x
+++ b/config/irix5.x
@@ -53,7 +53,7 @@ esac
# value conversion are broken by the compilers (as of 4/27/04 - QAK)
hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_works='no'}
-# Set flag to avoid conversion between 'long double' and integers because of
+# Set flags to avoid conversion between 'long double' and integers because of
# SGI's compiler problems. For both IRIX64 6.5 and IRIX 6.5, the compilers
# have the following problems,
# long double -> signed char : incorrect rounding
@@ -67,3 +67,4 @@ hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_work
# unsigned long or long long -> long double : correct value but incorrect bit pattern
# (1/5/05 - SLU)
hdf5_cv_sw_ldouble_to_int_works=${hdf5_cv_sw_ldouble_to_int_works='no'}
+hdf5_cv_sw_integer_to_ldouble_works=${hdf5_cv_sw_integer_to_ldouble_works='no'}
diff --git a/config/irix6.x b/config/irix6.x
index 293f2c8..7a50f78 100644
--- a/config/irix6.x
+++ b/config/irix6.x
@@ -146,7 +146,7 @@ fi
# value conversion are broken by the compilers (as of 4/27/04 - QAK)
hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_works='no'}
-# Set flag to avoid conversion between 'long double' and integers because of
+# Set flags to avoid conversion between 'long double' and integers because of
# SGI's compiler problems. For both IRIX64 6.5 and IRIX 6.5, the compilers
# have the following problems,
# long double -> signed char : incorrect rounding
@@ -159,4 +159,5 @@ hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_work
# long or long long -> long double : correct value but incorrect bit pattern
# unsigned long or long long -> long double : correct value but incorrect bit pattern
# (1/5/05 - SLU)
-hdf5_cv_sw_ldouble_to_int_works=${hdf5_cv_sw_ldouble_to_int_works='no'}
+hdf5_cv_sw_ldouble_to_integer_works=${hdf5_cv_sw_ldouble_to_integer_works='no'}
+hdf5_cv_sw_integer_to_ldouble_works=${hdf5_cv_sw_integer_to_ldouble_works='no'}
diff --git a/configure b/configure
index 7d5a85e..f394697 100755
--- a/configure
+++ b/configure
@@ -33547,19 +33547,41 @@ else
echo "${ECHO_T}no" >&6
fi
-echo "$as_me:$LINENO: checking if accurately converting between long double and integers works" >&5
-echo $ECHO_N "checking if accurately converting between long double and integers works... $ECHO_C" >&6
-if test "${hdf5_cv_sw_ldouble_to_int_works+set}" = set; then
+echo "$as_me:$LINENO: checking if accurately converting from long double to integers works" >&5
+echo $ECHO_N "checking if accurately converting from long double to integers works... $ECHO_C" >&6
+if test "${hdf5_cv_sw_ldouble_to_integer_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- hdf5_cv_sw_ldouble_to_int_works=yes
+ hdf5_cv_sw_ldouble_to_integer_works=yes
fi
-if test ${hdf5_cv_sw_ldouble_to_int_works} = "yes"; then
+if test ${hdf5_cv_sw_ldouble_to_integer_works} = "yes"; then
cat >>confdefs.h <<\_ACEOF
-#define SW_LDOUBLE_TO_INT_WORKS 1
+#define SW_LDOUBLE_TO_INTEGER_WORKS 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+echo "$as_me:$LINENO: checking if accurately converting from integers to long double works" >&5
+echo $ECHO_N "checking if accurately converting from integers to long double works... $ECHO_C" >&6
+if test "${hdf5_cv_sw_integer_to_ldouble_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ hdf5_cv_sw_integer_to_ldouble_works=yes
+fi
+
+
+if test ${hdf5_cv_sw_integer_to_ldouble_works} = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define SW_INTEGER_TO_LDOUBLE_WORKS 1
_ACEOF
echo "$as_me:$LINENO: result: yes" >&5
diff --git a/configure.in b/configure.in
index 580ed70..c48a525 100644
--- a/configure.in
+++ b/configure.in
@@ -2507,17 +2507,36 @@ else
fi
dnl -----------------------------------------------------------------------
-dnl Set flag to indicate that the machine can handle conversion between
-dnl long double and integers. (This flag should be set "yes" for all
-dnl machines except all SGIs, where some conversions are incorrect and its
-dnl cache value is set "no" in its config/irix6.x file.)
-dnl
-AC_MSG_CHECKING([if accurately converting between long double and integers works])
-AC_CACHE_VAL([hdf5_cv_sw_ldouble_to_int_works], [hdf5_cv_sw_ldouble_to_int_works=yes])
+dnl Set flag to indicate that the machine can handle conversion from
+dnl long double to integers. (This flag should be set "yes" for all
+dnl machines except all SGIs and HP-UX 11.00, where some conversions are
+dnl incorrect and its cache value is set "no" in its config/irix6.x and
+dnl irix5.x and config/hpux11.00 files.)
+dnl
+AC_MSG_CHECKING([if accurately converting from long double to integers works])
+AC_CACHE_VAL([hdf5_cv_sw_ldouble_to_integer_works], [hdf5_cv_sw_ldouble_to_integer_works=yes])
+
+if test ${hdf5_cv_sw_ldouble_to_integer_works} = "yes"; then
+ AC_DEFINE([SW_LDOUBLE_TO_INTEGER_WORKS], [1],
+ [Define if your system can accurately convert from long double to integer values.])
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
-if test ${hdf5_cv_sw_ldouble_to_int_works} = "yes"; then
- AC_DEFINE([SW_LDOUBLE_TO_INT_WORKS], [1],
- [Define if your system can accurately convert between long double and integer values.])
+dnl -----------------------------------------------------------------------
+dnl Set flag to indicate that the machine can handle conversion from
+dnl integers to long double. (This flag should be set "yes" for all
+dnl machines except all SGIs, where some conversions are
+dnl incorrect and its cache value is set "no" in its config/irix6.x and
+dnl irix5.x)
+dnl
+AC_MSG_CHECKING([if accurately converting from integers to long double works])
+AC_CACHE_VAL([hdf5_cv_sw_integer_to_ldouble_works], [hdf5_cv_sw_integer_to_ldouble_works=yes])
+
+if test ${hdf5_cv_sw_integer_to_ldouble_works} = "yes"; then
+ AC_DEFINE([SW_INTEGER_TO_LDOUBLE_WORKS], [1],
+ [Define if your system can accurately convert from integers to long double values.])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 7fb77be..d7f27f9 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -519,9 +519,13 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
-/* Define if your system can accurately convert between long double and
- integer values. */
-#undef SW_LDOUBLE_TO_INT_WORKS
+/* Define if your system can accurately convert from integers to long double
+ values. */
+#undef SW_INTEGER_TO_LDOUBLE_WORKS
+
+/* Define if your system can accurately convert from long double to integer
+ values. */
+#undef SW_LDOUBLE_TO_INTEGER_WORKS
/* Define if your system can accurately convert unsigned long long values to
floating-point values. */
diff --git a/test/dtypes.c b/test/dtypes.c
index d5079b3..90fbfe0 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -6368,7 +6368,7 @@ run_int_float_conv(const char *name)
#endif
if(!strcmp(name, "sw")) {
-#if H5_SW_LDOUBLE_TO_INT_WORKS
+#if H5_SW_INTEGER_TO_LDOUBLE_WORKS
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
nerrors += test_conv_int_float(name, H5T_NATIVE_SCHAR, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_float(name, H5T_NATIVE_UCHAR, H5T_NATIVE_LDOUBLE);
@@ -6397,7 +6397,7 @@ run_int_float_conv(const char *name)
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
#endif
#endif
-#else /*H5_SW_LDOUBLE_TO_INT_WORKS*/
+#else /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/
{
char str[256]; /*string */
@@ -6407,7 +6407,7 @@ run_int_float_conv(const char *name)
SKIPPED();
HDputs(" Test skipped due to hardware conversion error.");
}
-#endif /*H5_SW_LDOUBLE_TO_INT_WORKS*/
+#endif /*H5_SW_INTEGER_TO_LDOUBLE_WORKS*/
}
return nerrors;
@@ -6432,7 +6432,7 @@ static int
run_float_int_conv(const char *name)
{
int nerrors = 0;
-
+#ifndef TMP
nerrors += test_conv_int_float(name, H5T_NATIVE_FLOAT, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_float(name, H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR);
@@ -6493,8 +6493,9 @@ run_float_int_conv(const char *name)
#endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/
#endif
+#endif /*TMP*/
if(!strcmp(name, "sw")) {
-#if H5_SW_LDOUBLE_TO_INT_WORKS
+#if H5_SW_LDOUBLE_TO_INTEGER_WORKS
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
@@ -6524,7 +6525,7 @@ run_float_int_conv(const char *name)
#endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/
#endif
#endif
-#else /*H5_SW_LDOUBLE_TO_INT_WORKS*/
+#else /*H5_SW_LDOUBLE_TO_INTEGER_WORKS*/
{
char str[256]; /*hello string */
@@ -6534,7 +6535,7 @@ run_float_int_conv(const char *name)
SKIPPED();
HDputs(" Test skipped due to hardware conversion error.");
}
-#endif /*H5_SW_LDOUBLE_TO_INT_WORKS*/
+#endif /*H5_SW_LDOUBLE_TO_INTEGER_WORKS*/
}
return nerrors;
@@ -6969,7 +6970,7 @@ main(void)
if (ALIGNMENT)
printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
-
+#ifndef TMP
/* Do the tests */
nerrors += test_classes();
nerrors += test_copy();
@@ -7045,6 +7046,7 @@ main(void)
/* Test software float-integer conversion functions */
nerrors += run_float_int_conv("sw");
+#endif /*TMP*/
/* Test software integer-float conversion functions */
nerrors += run_int_float_conv("sw");