Compilation failure of user code with 1.8.15 due to undefinition of __attribute__

Hi,

We (Cactus developers) recently discovered that our code would not build with HDF5 1.8.15 due to a change to the way the __attribute__ preprocessor macro is handled by the HDF5 header files.

Previously (1.8.14), this attribute was undefined when C++ was used, but this only affected HDF5 source files, because the undefinition was in H5private.h. This was presumably fine, because the HDF5 source code could handle it. In 1.8.15, however, this code has moved into H5api_adpt.h, which is included by *users* of the HDF5 library. This means that __attribute__ is broken in any source file that included it. This attribute is important, because it controls things like vectorisation. The error we get is listed below.

The relevant commit seems to be SVN revision 26678 (https://github.com/live-clones/hdf5/commit/b283f087e32fb99023650240ef8290a3f46319c5).

I think it is important that this is fixed, possibly in a patch release, since it stops code from compiling.

(http://lists.einsteintoolkit.org/pipermail/users/2015-May/004168.html)

···

COMPILING arrangements/Carpet/CarpetIOHDF5/src/Output.cc
In file included from /opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include/x86intrin.h:29:0,
                from /opt/local/include/gcc49/c++/x86_64-apple-darwin14/bits/opt_random.h:33,
                from /opt/local/include/gcc49/c++/random:50,
                from /opt/local/include/gcc49/c++/bits/stl_algo.h:66,
                from /opt/local/include/gcc49/c++/algorithm:62,
                from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetLib/src/defs.hh:6,
                from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetLib/src/bbox.hh:10,
                from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/configs/sim/bindings/include/bbox.hh:4,
                from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/Carpet/src/functions.hh:17,
                from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/Carpet/src/carpet_public.hh:8,
                from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/configs/sim/bindings/include/carpet.hh:4,
                from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh:11,
                from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetIOHDF5/src/Output.cc:13:
/opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include/mmintrin.h: In function '__m64 _mm_cvtsi32_si64(int)':
/opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include/mmintrin.h:64:54: error: can't convert between vector values of different size
  return (__m64) __builtin_ia32_vec_init_v2si (__i, 0);
                                                     ^

--
Ian Hinder
http://members.aei.mpg.de/ianhin

Ian,

Thank you for your report! We are looking into the problem and will provide a patch or workaround. Stay tuned.

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On May 23, 2015, at 4:01 PM, Ian Hinder <ian.hinder@aei.mpg.de<mailto:ian.hinder@aei.mpg.de>> wrote:

Hi,

We (Cactus developers) recently discovered that our code would not build with HDF5 1.8.15 due to a change to the way the __attribute__ preprocessor macro is handled by the HDF5 header files.

Previously (1.8.14), this attribute was undefined when C++ was used, but this only affected HDF5 source files, because the undefinition was in H5private.h. This was presumably fine, because the HDF5 source code could handle it. In 1.8.15, however, this code has moved into H5api_adpt.h, which is included by *users* of the HDF5 library. This means that __attribute__ is broken in any source file that included it. This attribute is important, because it controls things like vectorisation. The error we get is listed below.

The relevant commit seems to be SVN revision 26678 (https://github.com/live-clones/hdf5/commit/b283f087e32fb99023650240ef8290a3f46319c5\).

I think it is important that this is fixed, possibly in a patch release, since it stops code from compiling.

(http://lists.einsteintoolkit.org/pipermail/users/2015-May/004168.html\)

COMPILING arrangements/Carpet/CarpetIOHDF5/src/Output.cc<http://Output.cc>
In file included from /opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include/x86intrin.h:29:0,
               from /opt/local/include/gcc49/c++/x86_64-apple-darwin14/bits/opt_random.h:33,
               from /opt/local/include/gcc49/c++/random:50,
               from /opt/local/include/gcc49/c++/bits/stl_algo.h:66,
               from /opt/local/include/gcc49/c++/algorithm:62,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetLib/src/defs.hh:6,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetLib/src/bbox.hh:10,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/configs/sim/bindings/include/bbox.hh:4,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/Carpet/src/functions.hh:17,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/Carpet/src/carpet_public.hh:8,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/configs/sim/bindings/include/carpet.hh:4,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh:11,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetIOHDF5/src/Output.cc<http://Output.cc>:13:
/opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include/mmintrin.h: In function '__m64 _mm_cvtsi32_si64(int)':
/opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include/mmintrin.h:64:54: error: can't convert between vector values of different size
return (__m64) __builtin_ia32_vec_init_v2si (__i, 0);
                                                    ^

--
Ian Hinder
http://members.aei.mpg.de/ianhin

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Ian,

Would it be possible for your team to provide us with a simple example to reproduce the problem? This will help us to decide on the patch.

Thank you!

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On May 23, 2015, at 4:01 PM, Ian Hinder <ian.hinder@aei.mpg.de<mailto:ian.hinder@aei.mpg.de>> wrote:

Hi,

We (Cactus developers) recently discovered that our code would not build with HDF5 1.8.15 due to a change to the way the __attribute__ preprocessor macro is handled by the HDF5 header files.

Previously (1.8.14), this attribute was undefined when C++ was used, but this only affected HDF5 source files, because the undefinition was in H5private.h. This was presumably fine, because the HDF5 source code could handle it. In 1.8.15, however, this code has moved into H5api_adpt.h, which is included by *users* of the HDF5 library. This means that __attribute__ is broken in any source file that included it. This attribute is important, because it controls things like vectorisation. The error we get is listed below.

The relevant commit seems to be SVN revision 26678 (https://github.com/live-clones/hdf5/commit/b283f087e32fb99023650240ef8290a3f46319c5\).

I think it is important that this is fixed, possibly in a patch release, since it stops code from compiling.

(http://lists.einsteintoolkit.org/pipermail/users/2015-May/004168.html\)

COMPILING arrangements/Carpet/CarpetIOHDF5/src/Output.cc<http://Output.cc>
In file included from /opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include/x86intrin.h:29:0,
               from /opt/local/include/gcc49/c++/x86_64-apple-darwin14/bits/opt_random.h:33,
               from /opt/local/include/gcc49/c++/random:50,
               from /opt/local/include/gcc49/c++/bits/stl_algo.h:66,
               from /opt/local/include/gcc49/c++/algorithm:62,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetLib/src/defs.hh:6,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetLib/src/bbox.hh:10,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/configs/sim/bindings/include/bbox.hh:4,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/Carpet/src/functions.hh:17,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/Carpet/src/carpet_public.hh:8,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/configs/sim/bindings/include/carpet.hh:4,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh:11,
               from /Users/depietri/EinsteinToolkit/ET_dev/Cactus/arrangements/Carpet/CarpetIOHDF5/src/Output.cc<http://Output.cc>:13:
/opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include/mmintrin.h: In function '__m64 _mm_cvtsi32_si64(int)':
/opt/local/lib/gcc49/gcc/x86_64-apple-darwin14/4.9.2/include/mmintrin.h:64:54: error: can't convert between vector values of different size
return (__m64) __builtin_ia32_vec_init_v2si (__i, 0);
                                                    ^

--
Ian Hinder
http://members.aei.mpg.de/ianhin

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

This has been reported previously as bug HDFFV-9384. Glad to see others think it is an issue, too.

Beyond compilation problems, it seems it could cause hard-to-diagnose crashes due to alignment attributes being ignored. (For avx /sse* instructions.) I haven't confirmed this, but the blanket removal of __attribute__() seems rash.

You can reproduce the compilation (pre-processing) error with just this:

test.cpp:
#include <H5Cpp.h>
#include <emmintrin.h>

-- Eric

All,

We are working on the patch release. Please try the patched version available at ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/hdf5/hdf5-1.8.15-patch1/.

Thank you!

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On May 27, 2015, at 8:13 PM, Eric A. Borisch <eborisch@gmail.com<mailto:eborisch@gmail.com>> wrote:

This has been reported previously as bug HDFFV-9384. Glad to see others think it is an issue, too.

Beyond compilation problems, it seems it could cause hard-to-diagnose crashes due to alignment attributes being ignored. (For avx /sse* instructions.) I haven't confirmed this, but the blanket removal of __attribute__() seems rash.

You can reproduce the compilation (pre-processing) error with just this:

test.cpp:
#include <H5Cpp.h>
#include <emmintrin.h>

-- Eric
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Hi,

The following will trigger the compilation error:

cat > hdf5.cc <<EOF
#include <hdf5.h>
#include <algorithm>
EOF

$ g++ --version
g++ (MacPorts gcc5 5.1.0_0) 5.1.0

$ g++ -c -std=c++11 hdf5.cc
In file included from /opt/local/lib/gcc5/gcc/x86_64-apple-darwin14/5.1.0/include/x86intrin.h:29:0,
                 from /opt/local/include/gcc5/c++/x86_64-apple-darwin14/bits/opt_random.h:33,
                 from /opt/local/include/gcc5/c++/random:50,
                 from /opt/local/include/gcc5/c++/bits/stl_algo.h:66,
                 from /opt/local/include/gcc5/c++/algorithm:62,
                 from hdf5.cc:2:
/opt/local/lib/gcc5/gcc/x86_64-apple-darwin14/5.1.0/include/mmintrin.h: In function '__m64 _mm_cvtsi32_si64(int)':
/opt/local/lib/gcc5/gcc/x86_64-apple-darwin14/5.1.0/include/mmintrin.h:64:54: error: can't convert between vector values of different size
   return (__m64) __builtin_ia32_vec_init_v2si (__i, 0);
                                                      ^

···

On 27 May 2015, at 14:51, Elena Pourmal [via hdf-forum] <ml-node+s184993n4027942h15@n3.nabble.com> wrote:

Ian,

Would it be possible for your team to provide us with a simple example to reproduce the problem? This will help us to decide on the patch.

--
Ian Hinder
http://members.aei.mpg.de/ianhin

Ian,

Thank you!

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On May 27, 2015, at 3:04 PM, Ian Hinder <ian.hinder@aei.mpg.de<mailto:ian.hinder@aei.mpg.de>> wrote:

On 27 May 2015, at 14:51, Elena Pourmal [via hdf-forum] <ml-node+s184993n4027942h15@n3.nabble.com<mailto:ml-node+s184993n4027942h15@n3.nabble.com>> wrote:

Ian,

Would it be possible for your team to provide us with a simple example to reproduce the problem? This will help us to decide on the patch.

Hi,

The following will trigger the compilation error:

cat > hdf5.cc<http://hdf5.cc/> <<EOF
#include <hdf5.h>
#include <algorithm>
EOF

$ g++ --version
g++ (MacPorts gcc5 5.1.0_0) 5.1.0

$ g++ -c -std=c++11 hdf5.cc<http://hdf5.cc/>
In file included from /opt/local/lib/gcc5/gcc/x86_64-apple-darwin14/5.1.0/include/x86intrin.h:29:0,
                 from /opt/local/include/gcc5/c++/x86_64-apple-darwin14/bits/opt_random.h:33,
                 from /opt/local/include/gcc5/c++/random:50,
                 from /opt/local/include/gcc5/c++/bits/stl_algo.h:66,
                 from /opt/local/include/gcc5/c++/algorithm:62,
                 from hdf5.cc<http://hdf5.cc/>:2:
/opt/local/lib/gcc5/gcc/x86_64-apple-darwin14/5.1.0/include/mmintrin.h: In function '__m64 _mm_cvtsi32_si64(int)':
/opt/local/lib/gcc5/gcc/x86_64-apple-darwin14/5.1.0/include/mmintrin.h:64:54: error: can't convert between vector values of different size
   return (__m64) __builtin_ia32_vec_init_v2si (__i, 0);
                                                      ^

--
Ian Hinder
http://members.aei.mpg.de/ianhin

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5