From 105b8b93a068e78a1c60b0d8c08755c66e81809a Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 20 Mar 2015 17:18:02 -0500 Subject: [svn-r26513] Description: Remove the LDOUBLE_TO_LLONG_ACCURATE macro/define, it's working around bugs in older SGI, HP/UX, MacOSX and Windows .NET 2003 compilers. Tested on: MacOSX/64 (amazon) 10.10.2 w/serial & parallel (h5committest not required on this branch) --- config/cmake/ConfigureChecks.cmake | 10 ------ config/cmake/ConversionTests.c | 39 ----------------------- config/cmake/H5pubconf.h.in | 4 --- configure.ac | 64 -------------------------------------- src/H5T.c | 4 --- src/H5Tconv.c | 4 --- src/H5Tpkg.h | 18 ----------- test/dt_arith.c | 32 ------------------- 8 files changed, 175 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index ce86dac..0aa4f1c 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -272,16 +272,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 -# 'long double' to '(unsigned) long long' values. (This flag should be set for -# all machines, except for Mac OS 10.4 and SGI IRIX64 6.5. When the bit sequence -# of long double is 0x4351ccf385ebc8a0bfcc2a3c..., the values of (unsigned)long long -# start to go wrong on these two machines. Adjusting it higher to -# 0x4351ccf385ebc8a0dfcc... or 0x4351ccf385ebc8a0ffcc... will make the converted -# values wildly wrong. This test detects this wrong behavior and disable the test. -# -H5ConversionTests (H5_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctly converting long double to (unsigned) long long values") -# ---------------------------------------------------------------------- -# 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 diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index d964bf8..beba01d 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -116,45 +116,6 @@ done: #endif -#ifdef H5_LDOUBLE_TO_LLONG_ACCURATE_TEST -int main(void) -{ - long double ld = 20041683600089727.779961L; - long long ll; - unsigned long long ull; - unsigned char s[16]; - int ret = 0; - - if(sizeof(long double) == 16) { - /*make sure the long double type is the same as the failing type - *which has 16 bytes in size and 11 bits of exponent. If it is, - *the bit sequence should be like below. It's not - *a decent way to check but this info isn't available. */ - memcpy(s, &ld, 16); - if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && - s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && - s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { - - /*slightly adjust the bit sequence (s[8]=0xdf). The converted - *values will go wild on Mac OS 10.4 and IRIX64 6.5.*/ - s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; - s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; - s[8]=0xdf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; - s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20; - - memcpy(&ld, s, 16); - ll = (long long)ld; - ull = (unsigned long long)ld; - - if(ll != 20041683600089728 || ull != 20041683600089728) - ret = 1; - } - } -done: - exit(ret); -} -#endif - #ifdef H5_LLONG_TO_LDOUBLE_CORRECT_TEST int main(void) { diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 3cd060d..aee2f2e 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -436,10 +436,6 @@ /* Define if HDF5's high-level library headers should be included in hdf5.h */ #cmakedefine H5_INCLUDE_HL @H5_INCLUDE_HL@ -/* Define if your system can convert long double to (unsigned) long long - values correctly. */ -#cmakedefine H5_LDOUBLE_TO_LLONG_ACCURATE @H5_LDOUBLE_TO_LLONG_ACCURATE@ - /* Define if your system converts long double to (unsigned) long values with special algorithm. */ #cmakedefine H5_LDOUBLE_TO_LONG_SPECIAL @H5_LDOUBLE_TO_LONG_SPECIAL@ diff --git a/configure.ac b/configure.ac index 4da0dfe..51e8158 100644 --- a/configure.ac +++ b/configure.ac @@ -2571,70 +2571,6 @@ fi ## ---------------------------------------------------------------------- ## Set the flag to indicate that the machine can accurately convert -## 'long double' to '(unsigned) long long' values. (This flag should be set for -## all machines, except for Mac OS 10.4 and SGI IRIX64 6.5. When the bit sequence -## of long double is 0x4351ccf385ebc8a0bfcc2a3c..., the values of (unsigned)long long -## start to go wrong on these two machines. Adjusting it higher to -## 0x4351ccf385ebc8a0dfcc... or 0x4351ccf385ebc8a0ffcc... will make the converted -## values wildly wrong. This test detects this wrong behavior and disable the test. -## -AC_MSG_CHECKING([if correctly converting long double to (unsigned) long long values]) - -if test ${ac_cv_sizeof_long_double} = 0; then - hdf5_cv_ldouble_to_llong_accurate=${hdf5_cv_ldouble_to_llong_accurate=no} -else - AC_CACHE_VAL([hdf5_cv_ldouble_to_llong_accurate], - [AC_TRY_RUN([ - int main(void) - { - long double ld = 20041683600089727.779961L; - long long ll; - unsigned long long ull; - unsigned char s[16]; - int ret = 0; - - if(sizeof(long double) == 16) { - /*make sure the long double type is the same as the failing type - *which has 16 bytes in size and 11 bits of exponent. If it is, - *the bit sequence should be like below. It's not - *a decent way to check but this info isn't available. */ - memcpy(s, &ld, 16); - if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && - s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && - s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { - - /*slightly adjust the bit sequence (s[8]=0xdf). The converted - *values will go wild on Mac OS 10.4 and IRIX64 6.5.*/ - s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; - s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; - s[8]=0xdf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; - s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20; - - memcpy(&ld, s, 16); - ll = (long long)ld; - ull = (unsigned long long)ld; - - if(ll != 20041683600089728 || ull != 20041683600089728) - ret = 1; - } - } - done: - exit(ret); - } - ], [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no],)]) -fi - -if test ${hdf5_cv_ldouble_to_llong_accurate} = "yes"; then - AC_DEFINE([LDOUBLE_TO_LLONG_ACCURATE], [1], - [Define if your system can convert long double to (unsigned) long long values correctly.]) - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -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 diff --git a/src/H5T.c b/src/H5T.c index 293a1d6..4e87f4f 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1278,16 +1278,12 @@ H5T_init_interface(void) /* From floats to long long */ status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_dxpl_id, FALSE); -#ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_dxpl_id, FALSE); -#endif /* H5T_CONV_INTERNAL_LDOUBLE_LLONG */ /* From floats to unsigned long long */ status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_dxpl_id, FALSE); -#if H5T_CONV_INTERNAL_LDOUBLE_ULLONG status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_dxpl_id, FALSE); -#endif /* H5T_CONV_INTERNAL_LDOUBLE_ULLONG */ /* * The special no-op conversion is the fastest, so we list it last. The diff --git a/src/H5Tconv.c b/src/H5Tconv.c index cb9a04a..b074932 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -8757,7 +8757,6 @@ H5T__conv_double_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_LDOUBLE_LLONG herr_t H5T__conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, @@ -8768,7 +8767,6 @@ H5_GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX); H5_GCC_DIAG_ON(float-equal) } -#endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/ /*------------------------------------------------------------------------- @@ -8786,7 +8784,6 @@ H5_GCC_DIAG_ON(float-equal) * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_LDOUBLE_ULLONG herr_t H5T__conv_ldouble_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, @@ -8795,7 +8792,6 @@ H5T__conv_ldouble_ullong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { H5T_CONV_Fx(LDOUBLE, ULLONG, long double, unsigned long long, 0, ULLONG_MAX); } -#endif /*H5T_CONV_INTERNAL_LDOUBLE_ULLONG*/ /*------------------------------------------------------------------------- diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 0b0cd61..e27d2c8 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -126,24 +126,6 @@ #define H5T_CONV_INTERNAL_ULLONG_LDOUBLE 1 #endif -/* Define an internal macro for converting long double to long long. SGI compilers give some incorrect - * conversions. Mac OS 10.4 gives incorrect conversions. HP-UX 11.00 compiler generates floating exception. - * The hard conversion on Windows .NET 2003 has a bug and gives wrong exception value. */ -#if (H5_WANT_DATA_ACCURACY && defined(H5_LDOUBLE_TO_LLONG_ACCURATE)) || \ - (!H5_WANT_DATA_ACCURACY) -#define H5T_CONV_INTERNAL_LDOUBLE_LLONG 1 -#endif - -/* Define an internal macro for converting long double to unsigned long long. SGI compilers give some - * incorrect conversions. Mac OS 10.4 gives incorrect conversions. HP-UX 11.00 compiler generates - * floating exception. */ -#if (H5_WANT_DATA_ACCURACY && defined(H5_LDOUBLE_TO_LLONG_ACCURATE)) || \ - (!H5_WANT_DATA_ACCURACY) -#define H5T_CONV_INTERNAL_LDOUBLE_ULLONG 1 -#else -#define H5T_CONV_INTERNAL_LDOUBLE_ULLONG 0 -#endif - /* Statistics about a conversion function */ struct H5T_stats_t { unsigned ncalls; /*num calls to conversion function */ diff --git a/test/dt_arith.c b/test/dt_arith.c index b6699c9..c8db431 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -5158,40 +5158,8 @@ run_fp_int_conv(const char *name) #endif /*H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0 */ #if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG && H5_SIZEOF_LONG_DOUBLE!=0 -#ifdef H5_LDOUBLE_TO_LLONG_ACCURATE nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG); -#else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ - { - char str[256]; /*string */ - - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, "long double", "long long"); - printf("%-70s", str); - SKIPPED(); -#if H5_SIZEOF_LONG_DOUBLE!=0 - HDputs(" Test skipped due to hardware conversion error."); -#else - HDputs(" Test skipped due to disabled long double."); -#endif - } -#endif /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ -#if defined(H5_LDOUBLE_TO_LLONG_ACCURATE) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG); -#else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ - { - char str[256]; /*string */ - - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, "long double", "unsigned long long"); - printf("%-70s", str); - SKIPPED(); -#if H5_SIZEOF_LONG_DOUBLE!=0 - HDputs(" Test skipped due to hardware conversion error."); -#else - HDputs(" Test skipped due to disabled long double."); -#endif - } -#endif /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ #endif #endif #ifndef H5_VMS -- cgit v0.12