From 5f0b88875da6860b0e9d94edb214427d20548277 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 19 Mar 2014 11:28:39 -0600 Subject: [PATCH] Add patch to fix long double conversions on ppc64le (bug #1078173) Run autoreconf for patches and to remove rpaths --- hdf5-ldouble-ppc64le.patch | 105 +++++++++++++++++++++++++++++++++++++ hdf5.spec | 14 ++++- 2 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 hdf5-ldouble-ppc64le.patch diff --git a/hdf5-ldouble-ppc64le.patch b/hdf5-ldouble-ppc64le.patch new file mode 100644 index 0000000..faa7f26 --- /dev/null +++ b/hdf5-ldouble-ppc64le.patch @@ -0,0 +1,105 @@ +diff -up hdf5-1.8.12/configure.ac.ldouble-ppc64le hdf5-1.8.12/configure.ac +--- hdf5-1.8.12/configure.ac.ldouble-ppc64le 2014-03-19 08:58:07.933233530 -0600 ++++ hdf5-1.8.12/configure.ac 2014-03-19 09:01:48.651040050 -0600 +@@ -3766,6 +3766,13 @@ else + unsigned char s2[8]; + int ret = 1; + ++#if defined __powerpc64__ && defined _LITTLE_ENDIAN ++ /* Don't bother checking on ppc64le, we know it'll work, and ++ * that what hdf5 calls 'special algorithm' simply is ++ * IBM ldouble 128 (i.e. two seperately scaled doubles). ++ * The check below assumes big endian. */ ++ ret = 0; ++#endif + 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, +@@ -3844,6 +3851,13 @@ else + unsigned char s[16]; + int flag=0, ret=1; + ++#if defined __powerpc64__ && defined _LITTLE_ENDIAN ++ /* Don't bother checking on ppc64le, we know it'll work, and ++ * that what hdf5 calls 'special algorithm' simply is ++ * IBM ldouble 128 (i.e. two seperately scaled doubles). ++ * The check below assumes big endian. */ ++ ret = 0; ++#endif + /*Determine if long double has 16 byte in size, 11 bit exponent, and + *the bias is 0x3ff */ + if(sizeof(long double) == 16) { +diff -up hdf5-1.8.12/configure.ldouble-ppc64le hdf5-1.8.12/configure +--- hdf5-1.8.12/configure.ldouble-ppc64le 2014-03-19 08:58:07.918233616 -0600 ++++ hdf5-1.8.12/configure 2014-03-19 08:58:07.932233536 -0600 +@@ -30362,6 +30362,13 @@ else + unsigned char s2[8]; + int ret = 1; + ++#if defined __powerpc64__ && defined _LITTLE_ENDIAN ++ /* Don't bother checking on ppc64le, we know it'll work, and ++ that what hdf5 calls 'special algorithm' simply is ++ IBM ldouble 128 (i.e. two seperately scaled doubles). ++ The check below assumes big endian. */ ++ ret = 0; ++#endif + 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, +@@ -30466,6 +30473,13 @@ else + unsigned char s[16]; + int flag=0, ret=1; + ++#if defined __powerpc64__ && defined _LITTLE_ENDIAN ++ /* Don't bother checking on ppc64le, we know it'll work, and ++ that what hdf5 calls 'special algorithm' simply is ++ IBM ldouble 128 (i.e. two seperately scaled doubles). ++ The check below assumes big endian. */ ++ ret = 0; ++#endif + /*Determine if long double has 16 byte in size, 11 bit exponent, and + *the bias is 0x3ff */ + if(sizeof(long double) == 16) { +diff -up hdf5-1.8.12/test/dt_arith.c.ldouble-ppc64le hdf5-1.8.12/test/dt_arith.c +--- hdf5-1.8.12/test/dt_arith.c.ldouble-ppc64le 2013-11-21 08:14:03.000000000 -0700 ++++ hdf5-1.8.12/test/dt_arith.c 2014-03-19 08:58:07.935233518 -0600 +@@ -3072,7 +3072,18 @@ test_conv_flt_1 (const char *name, int r + buf, saved, nelmts); + #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 + } else if(src_type == FLT_LDOUBLE) { +- INIT_FP_SPECIAL(src_size, src_nbits, sendian, LDBL_MANT_DIG, dst_size, ++ size_t mant_dig = LDBL_MANT_DIG; ++ if (mant_dig >= src_nbits) { ++ /* This happens for IBM long double in little endian. ++ The macro LDBL_MANT_DIG says 106 mantissa bits, but the ++ HDF5 detection code actually represents it as a normal 64bit ++ double (52 bit mantissa) with the upper double being ++ unspec bits (which is sort of okay as the testsuite ++ wouldn't deal with that format correctly anyway). So ++ override the mantissa size. */ ++ mant_dig = 52; ++ } ++ INIT_FP_SPECIAL(src_size, src_nbits, sendian, mant_dig, dst_size, + buf, saved, nelmts); + #endif + } else +@@ -3807,7 +3818,18 @@ test_conv_int_fp(const char *name, int r + INIT_FP_DENORM(long double, LDBL_MANT_DIG, src_size, src_nbits, sendian, dst_size, + buf, saved, nelmts); + } else { +- INIT_FP_SPECIAL(src_size, src_nbits, sendian, LDBL_MANT_DIG, dst_size, buf, saved, nelmts); ++ size_t mant_dig = LDBL_MANT_DIG; ++ if (mant_dig >= src_nbits) { ++ /* This happens for IBM long double in little endian. ++ The macro LDBL_MANT_DIG says 106 mantissa bits, but the ++ HDF5 detection code actually represents it as a normal 64bit ++ double (52 bit mantissa) with the upper double being ++ unspec bits (which is sort of okay as the testsuite ++ wouldn't deal with that format correctly anyway). So ++ override the mantissa size. */ ++ mant_dig = 52; ++ } ++ INIT_FP_SPECIAL(src_size, src_nbits, sendian, mant_dig, dst_size, buf, saved, nelmts); + } + #endif + } else diff --git a/hdf5.spec b/hdf5.spec index 9489d8a..d1005d9 100644 --- a/hdf5.spec +++ b/hdf5.spec @@ -7,7 +7,7 @@ # You need to recompile all users of HDF5 for each version change Name: hdf5 Version: 1.8.12 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A general purpose library and file format for storing scientific data License: BSD Group: System Environment/Libraries @@ -21,8 +21,14 @@ Patch0: hdf5-LD_LIBRARY_PATH.patch Patch1: hdf5-1.8.8-tstlite.patch # https://bugzilla.redhat.com/show_bug.cgi?id=925545 Patch2: hdf5-aarch64.patch +# Fix long double conversions on ppc64le +# https://bugzilla.redhat.com/show_bug.cgi?id=1078173 +Patch3: hdf5-ldouble-ppc64le.patch BuildRequires: krb5-devel, openssl-devel, zlib-devel, gcc-gfortran, time +# For patches/rpath +BuildRequires: automake +BuildRequires: libtool # Needed for mpi tests BuildRequires: openssh-clients @@ -152,8 +158,10 @@ HDF5 parallel openmpi static libraries %patch1 -p1 -b .tstlite %endif %patch2 -p1 -b .aarch64 +%patch3 -p1 -b .ldouble-ppc64le #This should be fixed in 1.8.7 find \( -name '*.[ch]*' -o -name '*.f90' -o -name '*.txt' \) -exec chmod -x {} + +autoreconf -f -i %build @@ -405,6 +413,10 @@ done %changelog +* Wed Mar 19 2014 Orion Poplawski - 1.8.12-5 +- Add patch to fix long double conversions on ppc64le (bug #1078173) +- Run autoreconf for patches and to remove rpaths + * Sat Feb 22 2014 Deji Akingunola - 1.8.12-4 - Rebuild for mpich-3.1