From acbcc04f88d9745215d01542b44ccb4c037ae4ce Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 10 Sep 2015 06:11:32 -0500 Subject: [svn-r27743] Merge of r26625 from the trunk Remove the LLONG_TO_LDOUBLE_CORRECT macro/define, it's working around bugs in very old SGI/FreeBSD/Windows compilers. Tested on: jam (minor change that has baked in the trunk for months) --- config/cmake/ConfigureChecks.cmake | 8 ---- config/cmake/ConversionTests.c | 43 ------------------ config/cmake/H5pubconf.h.in | 4 -- configure | 93 +------------------------------------- configure.ac | 65 -------------------------- release_docs/RELEASE.txt | 9 ++++ src/H5T.c | 4 -- src/H5Tconv.c | 4 -- src/H5Tpkg.h | 15 ------ src/H5config.h.in | 4 -- test/dt_arith.c | 24 ---------- 11 files changed, 10 insertions(+), 263 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 1c514eb..2f3d4d4 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -220,14 +220,6 @@ H5ConversionTests (H5_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts # H5ConversionTests (H5_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can convert (unsigned) long to long double values with special algorithm") # ---------------------------------------------------------------------- -# Set the flag to indicate that the machine can accurately convert -# '(unsigned) long long' to 'long double' values. (This flag should be set for -# all machines, except for Mac OS 10.4, when the bit sequences are 003fff..., -# 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice -# as big as they should be. -# -H5ConversionTests (H5_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values") -# ---------------------------------------------------------------------- # Set the flag to indicate that the machine generates bad code # for the H5VM_log2_gen() routine in src/H5VMprivate.h # (This flag should be set to no for all machines, except for SGI IRIX64, diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index beba01d..cd2e8bb 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -116,49 +116,6 @@ done: #endif -#ifdef H5_LLONG_TO_LDOUBLE_CORRECT_TEST -int main(void) -{ - long double ld; - long long ll; - unsigned long long ull; - unsigned char s[16]; - int flag=0, ret=0; - - /*Determine if long double has 16 byte in size, 11 bit exponent, and - *the bias is 0x3ff */ - if(sizeof(long double) == 16) { - ld = 1.0L; - memcpy(s, &ld, 16); - if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) - flag = 1; - } - - if(flag==1 && sizeof(long long)==8) { - ll = 0x01ffffffffffffffLL; - ld = (long double)ll; - memcpy(s, &ld, 16); - /*Check if the bit sequence is as supposed to be*/ - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || - s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || - s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) - ret = 1; - } - if(flag==1 && sizeof(unsigned long long)==8) { - ull = 0x01ffffffffffffffULL; - ld = (long double)ull; - memcpy(s, &ld, 16); - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || - s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || - s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) - ret = 1; - } -done: - exit(ret); -} -#endif - #ifdef H5_NO_ALIGNMENT_RESTRICTIONS_TEST #include diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 3bdf81e..4084adf 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -369,10 +369,6 @@ special algorithm. */ #cmakedefine H5_LDOUBLE_TO_LONG_SPECIAL @H5_LDOUBLE_TO_LONG_SPECIAL@ -/* Define if your system can convert (unsigned) long long to long double - values correctly. */ -#cmakedefine H5_LLONG_TO_LDOUBLE_CORRECT @H5_LLONG_TO_LDOUBLE_CORRECT@ - /* Define if your system can convert (unsigned) long to long double values with special algorithm. */ #cmakedefine H5_LONG_TO_LDOUBLE_SPECIAL @H5_LONG_TO_LDOUBLE_SPECIAL@ diff --git a/configure b/configure index 4a32637..e8851f3 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Id: configure.ac 27741 2015-09-10 10:38:47Z derobins . +# From configure.ac Id: configure.ac 27742 2015-09-10 10:59:56Z derobins . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for HDF5 1.8.16-snap16. # @@ -27470,97 +27470,6 @@ $as_echo "no" >&6; } fi ## ---------------------------------------------------------------------- -## Set the flag to indicate that the machine can accurately convert -## '(unsigned) long long' to 'long double' values. (This flag should be set for -## all machines, except for Mac OS 10.4, when the bit sequences are 003fff..., -## 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice -## as big as they should be. -## -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if correctly converting (unsigned) long long to long double values" >&5 -$as_echo_n "checking if correctly converting (unsigned) long long to long double values... " >&6; } - -if test ${ac_cv_sizeof_long_double} = 0; then - hdf5_cv_llong_to_ldouble_correct=${hdf5_cv_llong_to_ldouble_correct=no} -else - if ${hdf5_cv_llong_to_ldouble_correct+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - int main(void) - { - long double ld; - long long ll; - unsigned long long ull; - unsigned char s[16]; - int flag=0, ret=0; - - /*Determine if long double has 16 byte in size, 11 bit exponent, and - *the bias is 0x3ff */ - if(sizeof(long double) == 16) { - ld = 1.0L; - memcpy(s, &ld, 16); - if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) - flag = 1; - } - - if(flag==1 && sizeof(long long)==8) { - ll = 0x01ffffffffffffffLL; - ld = (long double)ll; - memcpy(s, &ld, 16); - /*Check if the bit sequence is as supposed to be*/ - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || - s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || - s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) - ret = 1; - } - if(flag==1 && sizeof(unsigned long long)==8) { - ull = 0x01ffffffffffffffULL; - ld = (long double)ull; - memcpy(s, &ld, 16); - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || - s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || - s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) - ret = 1; - } - done: - exit(ret); - } - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - hdf5_cv_llong_to_ldouble_correct=yes -else - hdf5_cv_llong_to_ldouble_correct=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi - -fi - -if test ${hdf5_cv_llong_to_ldouble_correct} = "yes"; then - -$as_echo "#define LLONG_TO_LDOUBLE_CORRECT 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - -## ---------------------------------------------------------------------- ## Set the flag to indicate that the machine generates bad code ## for the H5VM_log2_gen() routine in src/H5VMprivate.h ## (This flag should be set to no for all machines, except for SGI IRIX64, diff --git a/configure.ac b/configure.ac index 7346525..af391da 100644 --- a/configure.ac +++ b/configure.ac @@ -2381,71 +2381,6 @@ else fi ## ---------------------------------------------------------------------- -## Set the flag to indicate that the machine can accurately convert -## '(unsigned) long long' to 'long double' values. (This flag should be set for -## all machines, except for Mac OS 10.4, when the bit sequences are 003fff..., -## 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice -## as big as they should be. -## -AC_MSG_CHECKING([if correctly converting (unsigned) long long to long double values]) - -if test ${ac_cv_sizeof_long_double} = 0; then - hdf5_cv_llong_to_ldouble_correct=${hdf5_cv_llong_to_ldouble_correct=no} -else - AC_CACHE_VAL([hdf5_cv_llong_to_ldouble_correct], - [AC_TRY_RUN([ - int main(void) - { - long double ld; - long long ll; - unsigned long long ull; - unsigned char s[16]; - int flag=0, ret=0; - - /*Determine if long double has 16 byte in size, 11 bit exponent, and - *the bias is 0x3ff */ - if(sizeof(long double) == 16) { - ld = 1.0L; - memcpy(s, &ld, 16); - if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) - flag = 1; - } - - if(flag==1 && sizeof(long long)==8) { - ll = 0x01ffffffffffffffLL; - ld = (long double)ll; - memcpy(s, &ld, 16); - /*Check if the bit sequence is as supposed to be*/ - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || - s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || - s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) - ret = 1; - } - if(flag==1 && sizeof(unsigned long long)==8) { - ull = 0x01ffffffffffffffULL; - ld = (long double)ull; - memcpy(s, &ld, 16); - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || - s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || - s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) - ret = 1; - } - done: - exit(ret); - } - ], [hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],)]) -fi - -if test ${hdf5_cv_llong_to_ldouble_correct} = "yes"; then - AC_DEFINE([LLONG_TO_LDOUBLE_CORRECT], [1], - [Define if your system can convert (unsigned) long long to long double values correctly.]) - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi - -## ---------------------------------------------------------------------- ## Set the flag to indicate that the machine generates bad code ## for the H5VM_log2_gen() routine in src/H5VMprivate.h ## (This flag should be set to no for all machines, except for SGI IRIX64, diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 0eedcee..b7e81e1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -174,6 +174,15 @@ New Features (DER - 2015/09/10 HDFFV-9192) + - Removed LLONG_TO_LDOUBLE_CORRECT symbol and associated code from the + library. + + This was a part of a work-around for Visual Studio 6, OS X 10.4, + IRIX 6.5, and very old versions of FreeBSD and 64-bit Solaris. None + of these platforms/compilers are currently supported. + + (DER - 2015/09/10 HDFFV-9193) + Library ------- diff --git a/src/H5T.c b/src/H5T.c index 94fbb34..1eab57f 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1224,16 +1224,12 @@ H5T_init_interface(void) /* From long long to floats */ status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_ind_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_ind_dxpl_id, FALSE); -#ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_ind_dxpl_id, FALSE); -#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ /* From unsigned long long to floats */ status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_ind_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_ind_dxpl_id, FALSE); -#ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_ind_dxpl_id, FALSE); -#endif /* H5T_CONV_INTERNAL_ULLONG_LDOUBLE */ /* From floats to char */ status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_ind_dxpl_id, FALSE); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 5192a02..63f0e8e 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -7904,7 +7904,6 @@ H5T__conv_llong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_LLONG_LDOUBLE herr_t H5T__conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, @@ -7913,7 +7912,6 @@ H5T__conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { H5T_CONV_xF(LLONG, LDOUBLE, long long, long double, -, -); } -#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ /*------------------------------------------------------------------------- @@ -7981,7 +7979,6 @@ H5T__conv_ullong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_ULLONG_LDOUBLE herr_t H5T__conv_ullong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, @@ -7990,7 +7987,6 @@ H5T__conv_ullong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { H5T_CONV_xF(ULLONG, LDOUBLE, unsigned long long, long double, -, -); } -#endif /*H5T_CONV_INTERNAL_ULLONG_LDOUBLE*/ /*------------------------------------------------------------------------- diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index e27d2c8..4697bfc 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -111,21 +111,6 @@ /* (_not_ setting H5T_VISIT_SIMPLE and setting either H5T_VISIT_COMPLEX_FIRST or H5T_VISIT_COMPLEX_LAST will mean visiting all nodes _except_ "simple" "leafs" in the "tree" */ -/* Define an internal macro for converting long long to long double. Mac OS 10.4 gives some - * incorrect conversions. */ -#if (H5_WANT_DATA_ACCURACY && defined(H5_LLONG_TO_LDOUBLE_CORRECT)) || (!H5_WANT_DATA_ACCURACY) -#define H5T_CONV_INTERNAL_LLONG_LDOUBLE 1 -#endif - -/* Define an internal macro for converting unsigned long long to long double. SGI compilers give - * some incorect conversion. 64-bit Solaris does different rounding. Windows Visual Studio 6 does - * not support unsigned long long. For FreeBSD(sleipnir), the last 2 bytes of mantissa are lost when - * compiler tries to do the conversion. For Cygwin, compiler doesn't do rounding correctly. - * Mac OS 10.4 gives some incorrect result. */ -#if (H5_WANT_DATA_ACCURACY && defined(H5_LLONG_TO_LDOUBLE_CORRECT)) || (!H5_WANT_DATA_ACCURACY) -#define H5T_CONV_INTERNAL_ULLONG_LDOUBLE 1 -#endif - /* Statistics about a conversion function */ struct H5T_stats_t { unsigned ncalls; /*num calls to conversion function */ diff --git a/src/H5config.h.in b/src/H5config.h.in index e5e5d36..1de88d8 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -357,10 +357,6 @@ special algorithm. */ #undef LDOUBLE_TO_LONG_SPECIAL -/* Define if your system can convert (unsigned) long long to long double - values correctly. */ -#undef LLONG_TO_LDOUBLE_CORRECT - /* Define if your system can convert (unsigned) long to long double values with special algorithm. */ #undef LONG_TO_LDOUBLE_SPECIAL diff --git a/test/dt_arith.c b/test/dt_arith.c index 4caebaf..8e8ffba 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -4930,32 +4930,8 @@ run_int_fp_conv(const char *name) #endif #endif /* H5_SIZEOF_LONG!=H5_SIZEOF_INT */ #if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG -#if H5_LLONG_TO_LDOUBLE_CORRECT nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE); -#else /* H5_LLONG_TO_LDOUBLE_CORRECT */ - { - char str[256]; /*hello string */ - - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, "long long", "long double"); - printf("%-70s", str); - SKIPPED(); - HDputs(" Test skipped due to compiler error in handling conversion."); - } -#endif /* H5_LLONG_TO_LDOUBLE_CORRECT */ -#if H5_LLONG_TO_LDOUBLE_CORRECT nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE); -#else /* H5_LLONG_TO_LDOUBLE_CORRECT */ - { - char str[256]; /*hello string */ - - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, "unsigned long long", "long double"); - printf("%-70s", str); - SKIPPED(); - HDputs(" Test skipped due to compiler not handling conversion."); - } -#endif /* H5_LLONG_TO_LDOUBLE_CORRECT */ #endif #endif -- cgit v0.12