From fcdd0ab9dc93871fa600aface194b294947fad1b Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 15 Jun 2023 09:13:22 -0700 Subject: Revert long double checks (#3133) * Revert "Remove long double conversion work-arounds (#3097)" This reverts commit 1e1dac1dac58fa18f6b7788346d1ba7d3315b0f9. * Update comments to reflect newer systems --- config/cmake/ConfigureChecks.cmake | 93 ++++++++++++ config/cmake/ConversionTests.c | 287 +++++++++++++++++++++++++++++++++++++ config/cmake/H5pubconf.h.in | 23 +++ configure.ac | 173 ++++++++++++++++++++++ release_docs/INSTALL_CMake.txt | 1 + release_docs/RELEASE.txt | 22 --- src/H5T.c | 8 ++ src/H5Tconv.c | 8 ++ src/H5Tpkg.h | 31 ++++ test/dt_arith.c | 115 ++++++++++++++- 10 files changed, 736 insertions(+), 25 deletions(-) create mode 100644 config/cmake/ConversionTests.c diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 32faed4..8c401d9 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -560,6 +560,19 @@ endif () MARK_AS_ADVANCED (HDF5_STRICT_FORMAT_CHECKS) # ---------------------------------------------------------------------- +# Decide whether the data accuracy has higher priority during data +# conversions. If not, some hard conversions will still be preferred even +# though the data may be wrong (for example, some compilers don't +# support denormalized floating values) to maximize speed. +#----------------------------------------------------------------------------- +option (HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON) +mark_as_advanced (HDF5_WANT_DATA_ACCURACY) +if (HDF5_WANT_DATA_ACCURACY) + set (${HDF_PREFIX}_WANT_DATA_ACCURACY 1) +endif () +MARK_AS_ADVANCED (HDF5_WANT_DATA_ACCURACY) + +# ---------------------------------------------------------------------- # Decide whether the presence of user's exception handling functions is # checked and data conversion exceptions are returned. This is mainly # for the speed optimization of hard conversions. Soft conversions can @@ -847,3 +860,83 @@ if (HDF5_BUILD_FORTRAN) message (STATUS "maximum decimal precision for C var - ${${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION}") endif() + +#----------------------------------------------------------------------------- +# Macro to determine the various conversion capabilities +#----------------------------------------------------------------------------- +macro (H5ConversionTests TEST msg) + if (NOT DEFINED ${TEST}) + TRY_RUN (${TEST}_RUN ${TEST}_COMPILE + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_DIR}/ConversionTests.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-D${TEST}_TEST + OUTPUT_VARIABLE OUTPUT + ) + if (${TEST}_COMPILE) + if (${TEST}_RUN EQUAL "0") + set (${TEST} 1 CACHE INTERNAL ${msg}) + message (VERBOSE "${msg}... yes") + else () + set (${TEST} "" CACHE INTERNAL ${msg}) + message (VERBOSE "${msg}... no") + file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test ${TEST} Run failed with the following output and exit code:\n ${OUTPUT}\n" + ) + endif () + else () + set (${TEST} "" CACHE INTERNAL ${msg}) + message (VERBOSE "${msg}... no") + file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test ${TEST} Compile failed with the following output:\n ${OUTPUT}\n" + ) + endif () + + endif () +endmacro () + +#----------------------------------------------------------------------------- +# Check various conversion capabilities +#----------------------------------------------------------------------------- + +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine is using a special algorithm toconvert +# 'long double' to '(unsigned) long' values. (This flag should only be set for +# the IBM Power Linux. When the bit sequence of long double is +# 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long +# is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. +# The machine's conversion gets the correct value. We define the macro and disable +# this kind of test until we figure out what algorithm they use. +#----------------------------------------------------------------------------- +H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts long double to (unsigned) long values with special algorithm") +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine is using a special algorithm +# to convert some values of '(unsigned) long' to 'long double' values. +# (This flag should be off for all machines, except for IBM Power Linux, +# when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., +# ..., 7fffff..., the compiler uses a unknown algorithm. We define a +# macro and skip the test for now until we know about the algorithm. +#----------------------------------------------------------------------------- +H5ConversionTests (${HDF_PREFIX}_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 (${HDF_PREFIX}_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 +# as big as they should be. +#----------------------------------------------------------------------------- +H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values") +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine can accurately convert +# some long double values +#----------------------------------------------------------------------------- +H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV "Checking IF the cpu is power9 and cannot correctly converting long double values") diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c new file mode 100644 index 0000000..725f049 --- /dev/null +++ b/config/cmake/ConversionTests.c @@ -0,0 +1,287 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#if defined(__has_attribute) +# if __has_attribute(no_sanitize) +# define HDF_NO_UBSAN __attribute__((no_sanitize("undefined"))) +# else +# define HDF_NO_UBSAN +# endif +#else +# define HDF_NO_UBSAN +#endif + +#ifdef H5_LDOUBLE_TO_LONG_SPECIAL_TEST + +#include +#include + +int HDF_NO_UBSAN main(void) +{ + long double ld = 20041683600089727.779961L; + long ll; + unsigned long ull; + unsigned char s[16]; + unsigned char s2[8]; + int ret = 1; + + if (sizeof(long double) == 16 && sizeof(long) == 8) { + /* Make sure the long double type 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) { + + /* Assign the hexadecimal value of long double type. */ + 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; + s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20; + + memcpy(&ld, s, 16); + + ll = (long)ld; + memcpy(s2, &ll, 8); + + /* The library's algorithm converts it to 0x00 47 33 ce 17 af 22 82 + * and gets wrong value 20041683600089730 on Linux on IBM Power + * architecture. + * + * But Linux on IBM Power converts it to 0x00 47 33 ce 17 af 22 7f + * and gets the correct value 20041683600089727. It uses some special + * algorithm. We're going to define the macro and skip the test until + * we can figure out how they do it. + */ + if (s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && + s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) + + ret = 0; + + ull = (unsigned long)ld; + memcpy(s2, &ull, 8); + + /* The unsigned long is the same as signed long */ + if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce && + s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f) + + ret = 0; + } + } + +done: + exit(ret); +} + +#endif + +#ifdef H5_LONG_TO_LDOUBLE_SPECIAL_TEST + +#include +#include + +int HDF_NO_UBSAN main(void) +{ + long double ld; + long ll; + unsigned long ull; + unsigned char s[16]; + int flag=0, ret=1; + + /* 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)==8) { + ll = 0x003fffffffffffffL; + ld = (long double)ll; + memcpy(s, &ld, 16); + + /* The library converts the value to 0x434fffffffffffff8000000000000000. + * In decimal it is 18014398509481982.000000, one value short of the original. + * + * Linux on IBM Power architecture converts it to + * 0x4350000000000000bff0000000000000. The value is correct in decimal. + * It uses some special algorithm. We're going to define the macro and + * skip the test until we can figure out how they do it. + */ + if (s[0]==0x43 && s[1]==0x50 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && + s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && + s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) + + ret = 0; + } + + if (flag==1 && sizeof(unsigned long)==8) { + ull = 0xffffffffffffffffUL; + ld = (long double)ull; + memcpy(s, &ld, 16); + + /* Use a different value from signed long to test. The problem is the + * same for both long and unsigned long. The value is 18446744073709551615. + * The library converts the value to 0x43effffffffffffffe000000000000000. + * In decimal it's 18446744073709548544.000000, very different from the + * original. Linux on IBM Power architecture converts it to + * 0x43f0000000000000bff0000000000000. The value is correct in decimal. + * It uses some special algorithm. We're going to define the macro and + * skip the test until we can figure out how they do it. + */ + if (s[0]==0x43 && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 && + s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 && + s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00) + + ret = 0; + } +done: + exit(ret); +} + +#endif + +#ifdef H5_LDOUBLE_TO_LLONG_ACCURATE_TEST + +#include +#include + +int HDF_NO_UBSAN 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 + +#include +#include + +int HDF_NO_UBSAN 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 expected*/ + 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_DISABLE_SOME_LDOUBLE_CONV_TEST + +#include +#include +#include + +int HDF_NO_UBSAN main(void) +{ + FILE *fp; + char cpu[64]; + + fp = popen("uname -m", "r"); + + fgets(cpu, sizeof(cpu)-1, fp); + + pclose(fp); + + if (strncmp(cpu, "ppc64le", 7) == 0) + return 0; + + return 1; +} + +#endif diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 444a0e4..d4b0d36 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -32,6 +32,10 @@ /* Define if dev_t is a scalar */ #cmakedefine H5_DEV_T_IS_SCALAR @H5_DEV_T_IS_SCALAR@ +/* Define if your system is IBM ppc64le and cannot convert some long double + values correctly. */ +#cmakedefine H5_DISABLE_SOME_LDOUBLE_CONV @H5_DISABLE_SOME_LDOUBLE_CONV@ + /* Define to dummy `main' function (if any) required to link to the Fortran libraries. */ #cmakedefine H5_FC_DUMMY_MAIN @H5_FC_DUMMY_MAIN@ @@ -371,6 +375,22 @@ /* Define if new-style references should be used with dimension scales */ #cmakedefine H5_DIMENSION_SCALES_WITH_NEW_REF @H5_DIMENSION_SCALES_WITH_NEW_REF@ +/* 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@ + +/* 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@ + /* Define to the sub-directory where libtool stores uninstalled libraries. */ #cmakedefine H5_LT_OBJDIR @H5_LT_OBJDIR@ @@ -599,6 +619,9 @@ /* Version number of package */ #define H5_VERSION "@HDF5_PACKAGE_VERSION_STRING@" +/* Data accuracy is preferred to speed during data conversions */ +#cmakedefine H5_WANT_DATA_ACCURACY @H5_WANT_DATA_ACCURACY@ + /* Check exception handling functions during data conversions */ #cmakedefine H5_WANT_DCONV_EXCEPTION @H5_WANT_DCONV_EXCEPTION@ diff --git a/configure.ac b/configure.ac index 3c952e8..1a87357 100644 --- a/configure.ac +++ b/configure.ac @@ -3384,6 +3384,27 @@ else fi ## ---------------------------------------------------------------------- +## Decide whether the data accuracy has higher priority during data +## conversions. If not, some hard conversions will still be preferred even +## though the data may be wrong (for example, some compilers don't +## support denormalized floating values) to maximize speed. +## +AC_MSG_CHECKING([whether data accuracy is guaranteed during data conversions]) +AC_ARG_ENABLE([dconv-accuracy], + [AS_HELP_STRING([--enable-dconv-accuracy], + [if data accuracy is guaranteed during + data conversions [default=yes]])], + [DATA_ACCURACY=$enableval], [DATA_ACCURACY=yes]) + +if test "$DATA_ACCURACY" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE([WANT_DATA_ACCURACY], [1], + [Data accuracy is preferred to speed during data conversions]) +else + AC_MSG_RESULT([no]) +fi + +## ---------------------------------------------------------------------- ## Set the flag to indicate that the machine has window style pathname, ## that is, "drive-letter:\" (e.g. "C:") or "drive-letter:/" (e.g. "C:/"). ## (This flag should be _unset_ for all machines, except for Windows, where @@ -3403,6 +3424,158 @@ case "`uname`" in esac ## ---------------------------------------------------------------------- +## Set the flag to indicate that the machine is using a special algorithm to convert +## 'long double' to '(unsigned) long' values. (This flag should only be set for +## the IBM Power Linux. When the bit sequence of long double is +## 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long +## is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. +## The machine's conversion gets the correct value. We define the macro and disable +## this kind of test until we figure out what algorithm they use. +## +## CROSS-COMPILING: Assume 'no' +AC_MSG_CHECKING([if using special algorithm to convert long double to (unsigned) long values]) + +## NOTE: Place all configure test programs into cmake's source file, then use a preprocessor directive +## to select the proper test program. This is done by echoing the #define and cat'ing the cmake +## source file. (HDFFV-9467) + +TEST_SRC="`(echo \"#define H5_LDOUBLE_TO_LONG_SPECIAL_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`" + +if test ${ac_cv_sizeof_long_double} = 0; then + hdf5_cv_ldouble_to_long_special=${hdf5_cv_ldouble_to_long_special=no} +else + AC_CACHE_VAL([hdf5_cv_ldouble_to_long_special], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([$TEST_SRC])] + , [hdf5_cv_ldouble_to_long_special=yes], [hdf5_cv_ldouble_to_long_special=no], [hdf5_cv_ldouble_to_long_special=no])]) +fi + +if test ${hdf5_cv_ldouble_to_long_special} = "yes"; then + AC_DEFINE([LDOUBLE_TO_LONG_SPECIAL], [1], + [Define if your system converts long double to (unsigned) long values with special algorithm.]) + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +## ---------------------------------------------------------------------- +## Set the flag to indicate that the machine is using a special algorithm +## to convert some values of '(unsigned) long' to 'long double' values. +## (This flag should be off for all machines, except for IBM Power Linux, +## when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., +## ..., 7fffff..., the compiler uses a unknown algorithm. We define a +## macro and skip the test for now until we know about the algorithm. +## +## CROSS-COMPILING: Assume 'no' +AC_MSG_CHECKING([if using special algorithm to convert (unsigned) long to long double values]) + +TEST_SRC="`(echo \"#define H5_LONG_TO_LDOUBLE_SPECIAL_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`" + +if test ${ac_cv_sizeof_long_double} = 0; then + hdf5_cv_long_to_ldouble_special=${hdf5_cv_long_to_ldouble_special=no} +else + AC_CACHE_VAL([hdf5_cv_long_to_ldouble_special], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([$TEST_SRC])] + , [hdf5_cv_long_to_ldouble_special=yes], [hdf5_cv_long_to_ldouble_special=no], [hdf5_cv_long_to_ldouble_special=no])]) +fi + +if test ${hdf5_cv_long_to_ldouble_special} = "yes"; then + AC_DEFINE([LONG_TO_LDOUBLE_SPECIAL], [1], + [Define if your system can convert (unsigned) long to long double values with special algorithm.]) + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +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, SGI IRIX64 6.5 and +## Powerpc Linux using XL compilers. +## 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. +## +## CROSS-COMPILING: Assume 'yes' +AC_MSG_CHECKING([if correctly converting long double to (unsigned) long long values]) + +TEST_SRC="`(echo \"#define H5_LDOUBLE_TO_LLONG_ACCURATE_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`" + +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_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], + [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no], [hdf5_cv_ldouble_to_llong_accurate=yes])]) +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 and Powerpc Linux using +## XL compilers. +## When the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., +## ..., 7fffff..., the converted values are twice as big as they should be. +## +## CROSS-COMPILING: Assume 'yes' +AC_MSG_CHECKING([if correctly converting (unsigned) long long to long double values]) + +TEST_SRC="`(echo \"#define H5_LLONG_TO_LDOUBLE_CORRECT_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`" + +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_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], + [hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no], [hdf5_cv_llong_to_ldouble_correct=yes])]) +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 is IBM ppc64le and cannot +## accurately convert some long double values. +## +## CROSS-COMPILING: Assume 'yes' +AC_MSG_CHECKING([if the system is IBM ppc64le and cannot correctly convert some long double values]) + +TEST_SRC="`(echo \"#define H5_DISABLE_SOME_LDOUBLE_CONV_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`" + +if test ${ac_cv_sizeof_long_double} = 0; then + hdf5_cv_disable_some_ldouble_conv=${hdf5_cv_disable_some_ldouble_conv=no} +else + AC_CACHE_VAL([hdf5_cv_disable_some_ldouble_conv], + [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], + [hdf5_cv_disable_some_ldouble_conv=yes], [hdf5_cv_disable_some_ldouble_conv=no], [hdf5_cv_disable_some_ldouble_conv=yes])]) +fi + +if test ${hdf5_cv_disable_some_ldouble_conv} = "yes"; then + AC_DEFINE([DISABLE_SOME_LDOUBLE_CONV], [1], + [Define if your system is IBM ppc64le and cannot convert some long double values correctly.]) + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +## ---------------------------------------------------------------------- ## Set some variables for general configuration information to be saved ## and installed with the libraries (used to generate libhdf5.settings). ## diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 5a011e7..6816b1a 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -834,6 +834,7 @@ HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF DEFAULT_API_VERSION "Enable default API (v16, v18, v110, v112, v114)" "v114" HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON +HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON HDF5_ENABLE_THREADSAFE "Enable Threadsafety" OFF HDF5_MSVC_NAMING_CONVENTION "Use MSVC Naming conventions for Shared Libraries" OFF diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 2abc003..9fa590a 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -65,28 +65,6 @@ New Features The functionality of H5detect is now exercised at library startup, so H5detect has been removed. - - Removed long double work-around symbols and configure options - - Several options and public symbols that were provided to paper over - non-standard long double conversions between signed/unsigned long - and long long values were removed from the Autotools and CMake. These - were added twenty years ago, when C99 and 64-bit platforms were less - common and are no longer needed. - - Autotools: - --enable-dconv-accuracy - - CMake: - HDF5_WANT_DATA_ACCURACY - - H5pubconf.h symbols: - H5_WANT_DATA_ACCURACY - H5_LDOUBLE_TO_LONG_SPECIAL - H5_LONG_TO_LDOUBLE_SPECIAL - H5_LDOUBLE_TO_LLONG_ACCURATE - H5_LLONG_TO_LDOUBLE_CORRECT - H5_DISABLE_SOME_LDOUBLE_CONV - - Updated HDF5 API tests CMake code to support VOL connectors * Implemented support for fetching, building and testing HDF5 diff --git a/src/H5T.c b/src/H5T.c index 6475164..516000a 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1276,16 +1276,20 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float); status |= H5T__register_int(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double); +#ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE status |= H5T__register_int(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble); +#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ /* From unsigned long long to floats */ status |= H5T__register_int(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float); status |= H5T__register_int(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double); +#ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE status |= H5T__register_int(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble); +#endif /* H5T_CONV_INTERNAL_ULLONG_LDOUBLE */ /* From floats to char */ status |= @@ -1349,16 +1353,20 @@ H5T_init(void) H5T__register_int(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong); status |= H5T__register_int(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong); +#ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG status |= H5T__register_int(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong); +#endif /* H5T_CONV_INTERNAL_LDOUBLE_LLONG */ /* From floats to unsigned long long */ status |= H5T__register_int(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong); status |= H5T__register_int(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong); +#if H5T_CONV_INTERNAL_LDOUBLE_ULLONG status |= H5T__register_int(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong); +#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 55725b3..8118eb0 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -7656,12 +7656,14 @@ H5T__conv_llong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * *------------------------------------------------------------------------- */ +#ifdef 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, size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5T_CONV_xF(LLONG, LDOUBLE, long long, long double, -, -); } +#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_float @@ -7716,12 +7718,14 @@ H5T__conv_ullong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * *------------------------------------------------------------------------- */ +#ifdef 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, size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5T_CONV_xF(ULLONG, LDOUBLE, unsigned long long, long double, -, -); } +#endif /*H5T_CONV_INTERNAL_ULLONG_LDOUBLE*/ /*------------------------------------------------------------------------- * Function: H5T__conv_float_schar @@ -8352,6 +8356,7 @@ H5T__conv_double_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * *------------------------------------------------------------------------- */ +#ifdef 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, size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) @@ -8360,6 +8365,7 @@ H5T__conv_ldouble_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX); H5_GCC_CLANG_DIAG_ON("float-equal") } +#endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/ /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_ullong @@ -8374,6 +8380,7 @@ H5T__conv_ldouble_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * *------------------------------------------------------------------------- */ +#ifdef 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, size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) @@ -8382,6 +8389,7 @@ H5T__conv_ldouble_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t H5T_CONV_Fx(LDOUBLE, ULLONG, long double, unsigned long long, 0, ULLONG_MAX); H5_GCC_CLANG_DIAG_ON("float-equal") } +#endif /*H5T_CONV_INTERNAL_LDOUBLE_ULLONG*/ /*------------------------------------------------------------------------- * Function: H5T__conv_f_i diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index df16413..23fa960 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -112,6 +112,37 @@ /* (_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 incorrect 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 + +/* 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 ccf2ec9..a26945f 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -11,6 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * * Purpose: Tests the data type interface (H5T) */ @@ -4842,7 +4845,20 @@ run_fp_tests(const char *name) #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE); nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE); +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT); +#else + { + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, "long double", + "float"); + HDprintf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); + } +#endif + nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); #endif @@ -4852,8 +4868,20 @@ run_fp_tests(const char *name) #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE); nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE); +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT); nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); +#else + { + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", + "float or double"); + HDprintf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); + } +#endif #endif done: @@ -4919,12 +4947,47 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_INT, H5T_NATIVE_LDOUBLE); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_LDOUBLE); #if H5_SIZEOF_LONG != H5_SIZEOF_INT +#if !defined(H5_LONG_TO_LDOUBLE_SPECIAL) && !defined(H5_DISABLE_SOME_LDOUBLE_CONV) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE); +#else + { + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "(unsigned) long", + "long double"); + HDprintf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to the special algorithm of hardware conversion."); + } +#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"); + HDprintf("%-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"); + HDprintf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to compiler not handling conversion."); + } +#endif /* H5_LLONG_TO_LDOUBLE_CORRECT */ #endif #endif @@ -5000,31 +5063,77 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); } else { +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); +#else + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", + "signed and unsigned char, short, int, long"); + HDprintf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); +#endif } #if H5_SIZEOF_LONG != H5_SIZEOF_INT +#ifndef H5_LDOUBLE_TO_LONG_SPECIAL if (test_values != TEST_SPECIAL && test_values != TEST_NORMAL) { nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); } else { +#ifndef H5_DISABLE_SOME_LDOUBLE_CONV nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG); +#endif + } +#else + { + char str[256]; /*string */ + + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", + "(unsigned) long"); + HDprintf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to the special algorithm of hardware conversion."); } +#endif #endif /*H5_SIZEOF_LONG!=H5_SIZEOF_INT */ #if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG +#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"); + HDprintf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to hardware conversion error."); + } +#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); -#endif /* H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG */ +#else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ + { + char str[256]; /*string */ -#endif /* H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE */ - } /* end for */ + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", + "unsigned long long"); + HDprintf("%-70s", str); + SKIPPED(); + HDputs(" Test skipped due to hardware conversion error."); + } +#endif /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ +#endif +#endif + } /* end for */ return nerrors; } -- cgit v0.12