From 01557377c2d5f9ae44123331800d74d4138a1f93b08510d46d9da0d7dd4145b3 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 16 Jan 2014 14:37:39 +0000 Subject: [PATCH] Accepting request 213737 from devel:libraries:c_c++ (forwarded request 213736 from matz2) OBS-URL: https://build.opensuse.org/request/show/213737 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hdf5?expand=0&rev=18 --- hdf5-ldouble-ppc64le.patch | 108 +++++++++++++++++++++++++++++++++++++ hdf5.changes | 8 +++ hdf5.spec | 4 +- 3 files changed, 119 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..b941742 --- /dev/null +++ b/hdf5-ldouble-ppc64le.patch @@ -0,0 +1,108 @@ +Index: hdf5-1.8.12/configure +=================================================================== +--- hdf5-1.8.12/configure.orig ++++ hdf5-1.8.12/configure +@@ -30364,6 +30364,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, +@@ -30468,6 +30475,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) { +Index: hdf5-1.8.12/configure.ac +=================================================================== +--- hdf5-1.8.12/configure.ac.orig ++++ hdf5-1.8.12/configure.ac +@@ -3768,6 +3768,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, +@@ -3846,6 +3853,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) { +Index: hdf5-1.8.12/test/dt_arith.c +=================================================================== +--- hdf5-1.8.12/test/dt_arith.c.orig ++++ hdf5-1.8.12/test/dt_arith.c +@@ -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 +@@ -3808,7 +3819,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.changes b/hdf5.changes index b5f629a..635d755 100644 --- a/hdf5.changes +++ b/hdf5.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sun Jan 5 03:59:20 UTC 2014 - matz@suse.de + +- Detect IBM long double specialness on ppc64le and don't segfault + int the testsuite when checking that type. + Added patches: + * hdf5-ldouble-ppc64le.patch + ------------------------------------------------------------------- Tue Nov 26 14:27:16 UTC 2013 - pgajdos@suse.com diff --git a/hdf5.spec b/hdf5.spec index 14b7ba1..e6dc411 100644 --- a/hdf5.spec +++ b/hdf5.spec @@ -1,7 +1,7 @@ # # spec file for package hdf5 # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -47,6 +47,7 @@ Patch2: hdf5-1.8.11-abort_unknown_host_config.patch Patch4: hdf5-1.8.10-tests-arm.patch %endif Patch5: hdf5-configure-long-double.patch +Patch6: hdf5-ldouble-ppc64le.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: gcc-c++ %if 0%{?suse_version} > 1140 @@ -288,6 +289,7 @@ test "%{hdf5_libver}" = "${LT_VERS_INTERFACE}" || exit 1 %patch4 -p0 -b .tests-arm %endif %patch5 -p1 +%patch6 -p1 echo "prepare parallel builds: %_mpi" for build_dir in build %_mpi; do