Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure on 32 bit architectures: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion] #443

Open
sanjayankur31 opened this issue Apr 17, 2021 · 7 comments · Fixed by #565

Comments

@sanjayankur31
Copy link

Describe the bug
While building HighFive for inclusion in NeuroFedora, we're seeing builds fail on 32 bit architectures: i686 and armv7hl

To Reproduce
Steps to reproduce the behavior:
Attempt to build on a 32 bit platform

Expected behavior
Build should pass (or if 32 bit architectures aren't supported, this should be documented)

Stacktrace

[ 19%] Building CXX object src/examples/CMakeFiles/boost_ublas_double_bin.dir/boost_ublas_double.cpp.o
cd /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu/src/examples && /usr/bin/g++ -DBOOST_ALL_NO_LIB -DH5_USE_BOOST -DH5_USE_EIGEN -DH5_USE_XTENSOR -DMPI_NO_CPPBIND -D_FILE_OFFSET_BITS=64 -I/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include -isystem /usr/include/eigen3 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -g  -Wall -Wextra -Wno-unused-parameter  -Werror -Wshadow -Wnon-virtual-dtor -Wunused -Woverloaded-virtual -Wformat=2 -Wconversion -Wsign-conversion -Wno-error=deprecated-declarations -Wpedantic -Wcast-align -Wdouble-promotion -O2 -std=c++14 -o CMakeFiles/boost_multi_array_2D_bin.dir/boost_multi_array_2D.cpp.o -c /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/boost_multi_array_2D.cpp
cd /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu/src/examples && /usr/bin/g++ -DBOOST_ALL_NO_LIB -DH5_USE_BOOST -DH5_USE_EIGEN -DH5_USE_XTENSOR -DMPI_NO_CPPBIND -D_FILE_OFFSET_BITS=64 -I/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include -isystem /usr/include/eigen3 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -g  -Wall -Wextra -Wno-unused-parameter  -Werror -Wshadow -Wnon-virtual-dtor -Wunused -Woverloaded-virtual -Wformat=2 -Wconversion -Wsign-conversion -Wno-error=deprecated-declarations -Wpedantic -Wcast-align -Wdouble-promotion -O2 -std=c++14 -o CMakeFiles/boost_ublas_double_bin.dir/boost_ublas_double.cpp.o -c /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/boost_ublas_double.cpp
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../H5Reference.hpp:80,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Converter_misc.hpp:30,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:25,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/select_by_id_dataset_cpp11.cpp:14:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp:23:52: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   23 |         return H5Iget_name(object.getId(), buffer, length); });
      |                                                    ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/select_by_id_dataset_cpp11.cpp:14:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:32:34: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   32 |         return H5Aget_name(_hid, length, buffer);
      |                                  ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../H5Reference.hpp:80,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Converter_misc.hpp:30,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:25,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/boost_ublas_double.cpp:19:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp:23:52: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   23 |         return H5Iget_name(object.getId(), buffer, length); });
      |                                                    ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../H5Reference.hpp:80,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Converter_misc.hpp:30,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:25,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/create_extensible_dataset.cpp:15:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp:23:52: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   23 |         return H5Iget_name(object.getId(), buffer, length); });
      |                                                    ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:90,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/select_by_id_dataset_cpp11.cpp:14:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp:81:49: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   81 |             return H5Fget_name(getId(), buffer, length);
      |                                                 ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../H5Reference.hpp:80,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Converter_misc.hpp:30,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:25,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/select_partial_dataset_cpp11.cpp:14:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp:23:52: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   23 |         return H5Iget_name(object.getId(), buffer, length); });
      |                                                    ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../H5Reference.hpp:80,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Converter_misc.hpp:30,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:25,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/renaming_objects.cpp:1:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp:23:52: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   23 |         return H5Iget_name(object.getId(), buffer, length); });
      |                                                    ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../H5Reference.hpp:80,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Converter_misc.hpp:30,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:25,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/boost_multi_array_2D.cpp:15:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp:23:52: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   23 |         return H5Iget_name(object.getId(), buffer, length); });
      |                                                    ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/create_extensible_dataset.cpp:15:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:32:34: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   32 |         return H5Aget_name(_hid, length, buffer);
      |                                  ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/renaming_objects.cpp:1:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:32:34: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   32 |         return H5Aget_name(_hid, length, buffer);
      |                                  ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/boost_ublas_double.cpp:19:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:32:34: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   32 |         return H5Aget_name(_hid, length, buffer);
      |                                  ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../H5Reference.hpp:80,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Converter_misc.hpp:30,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:25,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/read_write_single_scalar.cpp:13:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp:23:52: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   23 |         return H5Iget_name(object.getId(), buffer, length); });
      |                                                    ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:90,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/create_extensible_dataset.cpp:15:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp:81:49: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   81 |             return H5Fget_name(getId(), buffer, length);
      |                                                 ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:90,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/renaming_objects.cpp:1:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp:81:49: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   81 |             return H5Fget_name(getId(), buffer, length);
      |                                                 ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/boost_multi_array_2D.cpp:15:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:32:34: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   32 |         return H5Aget_name(_hid, length, buffer);
      |                                  ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:90,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/boost_ublas_double.cpp:19:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp:81:49: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   81 |             return H5Fget_name(getId(), buffer, length);
      |                                                 ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/select_partial_dataset_cpp11.cpp:14:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:32:34: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   32 |         return H5Aget_name(_hid, length, buffer);
      |                                  ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/read_write_single_scalar.cpp:13:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:32:34: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   32 |         return H5Aget_name(_hid, length, buffer);
      |                                  ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:90,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/boost_multi_array_2D.cpp:15:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp:81:49: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   81 |             return H5Fget_name(getId(), buffer, length);
      |                                                 ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:90,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/select_partial_dataset_cpp11.cpp:14:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp:81:49: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   81 |             return H5Fget_name(getId(), buffer, length);
      |                                                 ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:90,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/read_write_single_scalar.cpp:13:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp:81:49: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   81 |             return H5Fget_name(getId(), buffer, length);
      |                                                 ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../H5Reference.hpp:80,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Converter_misc.hpp:30,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:25,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/read_write_vector_dataset_references.cpp:15:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/../bits/H5Reference_misc.hpp:23:52: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   23 |         return H5Iget_name(object.getId(), buffer, length); });
      |                                                    ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:92,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/renaming_objects.cpp:1:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Path_traits_misc.hpp: In instantiation of 'std::string HighFive::PathTraits<Derivate>::getPath() const [with Derivate = HighFive::Group; std::string = std::__cxx11::basic_string<char>]':
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/renaming_objects.cpp:37:49:   required from here
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Path_traits_misc.hpp:39:81: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   39 |         return H5Iget_name(static_cast<const Derivate*>(this)->getId(), buffer, length);
      |                                                                                 ^~~~~~
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Path_traits_misc.hpp: In instantiation of 'std::string HighFive::PathTraits<Derivate>::getPath() const [with Derivate = HighFive::DataSet; std::string = std::__cxx11::basic_string<char>]':
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/renaming_objects.cpp:38:53:   required from here
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Path_traits_misc.hpp:39:81: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Annotate_traits_misc.hpp:18,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:89,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/read_write_vector_dataset_references.cpp:15:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5Attribute_misc.hpp:32:34: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   32 |         return H5Aget_name(_hid, length, buffer);
      |                                  ^~~~~~
In file included from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/H5File.hpp:90,
                 from /builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/src/examples/read_write_vector_dataset_references.cpp:15:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp: In lambda function:
/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/include/highfive/bits/H5File_misc.hpp:81:49: error: conversion from 'hsize_t' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
   81 |             return H5Fget_name(getId(), buffer, length);
      |                                                 ^~~~~~
cc1plus: all warnings being treated as errors
gmake[2]: Leaving directory '/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu'
gmake[2]: *** [src/examples/CMakeFiles/boost_multi_array_2D_bin.dir/build.make:85: src/examples/CMakeFiles/boost_multi_array_2D_bin.dir/boost_multi_array_2D.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:304: src/examples/CMakeFiles/boost_multi_array_2D_bin.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
cc1plus: all warnings being treated as errors
cc1plus: all warnings being treated as errors
gmake[2]: Leaving directory '/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu'
gmake[2]: *** [src/examples/CMakeFiles/read_write_single_scalar_bin.dir/build.make:85: src/examples/CMakeFiles/read_write_single_scalar_bin.dir/read_write_single_scalar.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:331: src/examples/CMakeFiles/read_write_single_scalar_bin.dir/all] Error 2
gmake[2]: *** [src/examples/CMakeFiles/boost_ublas_double_bin.dir/build.make:85: src/examples/CMakeFiles/boost_ublas_double_bin.dir/boost_ublas_double.cpp.o] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu'
gmake[1]: *** [CMakeFiles/Makefile2:358: src/examples/CMakeFiles/boost_ublas_double_bin.dir/all] Error 2
cc1plus: all warnings being treated as errors
gmake[2]: *** [src/examples/CMakeFiles/renaming_objects_bin.dir/build.make:85: src/examples/CMakeFiles/renaming_objects_bin.dir/renaming_objects.cpp.o] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu'
gmake[1]: *** [CMakeFiles/Makefile2:250: src/examples/CMakeFiles/renaming_objects_bin.dir/all] Error 2
cc1plus: all warnings being treated as errors
gmake[2]: *** [src/examples/CMakeFiles/select_by_id_dataset_cpp11_bin.dir/build.make:85: src/examples/CMakeFiles/select_by_id_dataset_cpp11_bin.dir/select_by_id_dataset_cpp11.cpp.o] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu'
gmake[1]: *** [CMakeFiles/Makefile2:223: src/examples/CMakeFiles/select_by_id_dataset_cpp11_bin.dir/all] Error 2
cc1plus: all warnings being treated as errors
cc1plus: all warnings being treated as errors
gmake[2]: *** [src/examples/CMakeFiles/create_extensible_dataset_bin.dir/build.make:85: src/examples/CMakeFiles/create_extensible_dataset_bin.dir/create_extensible_dataset.cpp.o] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu'
gmake[1]: *** [CMakeFiles/Makefile2:385: src/examples/CMakeFiles/create_extensible_dataset_bin.dir/all] Error 2
gmake[2]: *** [src/examples/CMakeFiles/select_partial_dataset_cpp11_bin.dir/build.make:85: src/examples/CMakeFiles/select_partial_dataset_cpp11_bin.dir/select_partial_dataset_cpp11.cpp.o] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu'
gmake[1]: *** [CMakeFiles/Makefile2:196: src/examples/CMakeFiles/select_partial_dataset_cpp11_bin.dir/all] Error 2
cc1plus: all warnings being treated as errors
gmake[2]: *** [src/examples/CMakeFiles/read_write_vector_dataset_references_bin.dir/build.make:85: src/examples/CMakeFiles/read_write_vector_dataset_references_bin.dir/read_write_vector_dataset_references.cpp.o] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu'
gmake[1]: Leaving directory '/builddir/build/BUILD/HighFive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d/i686-redhat-linux-gnu'
gmake[1]: *** [CMakeFiles/Makefile2:277: src/examples/CMakeFiles/read_write_vector_dataset_references_bin.dir/all] Error 2
gmake: *** [Makefile:163: all] Error 2

Complete build log attached:
highfive-b8998c6b90f3b1411f4c91f0c5491d738a5f611d-build-log.txt

Desktop (please complete the following information):

  • OS: Fedora 35/rawhide
  • Version: tested with both version 2.2.2 and commit b8998c6

Additional context
Here's the test build on the Fedora builders where only armv7hl and i686 fail:

https://koji.fedoraproject.org/koji/taskinfo?taskID=66124517

@ferdonline
Copy link
Contributor

Hi @sanjayankur31 and thanks for reporting it.
We don't really have 32bit systems to test, but I assume this can be easily fixed with proper static_cast<size_t>.
If you have fixed (or plan to) we would be happy to accept the contribution. Otherwise we will add this to our backlog, and eventually ask for your support testing.

@sanjayankur31
Copy link
Author

Hi @ferdonline , thanks for your reply.

It isn't on my backlog at the moment. It'll be best to add it to the project backlog, and if/when I do find the time to work on a fix, I'll open a PR.

For the time being, we've excluded the 32 bit arches for highfive (and so all the software that depends on it). Our downstream tracker bug is here:

https://bugzilla.redhat.com/show_bug.cgi?id=1952348

sanjayankur31 added a commit to sanjayankur31/HighFive that referenced this issue Apr 29, 2021
Explicitly casts long long unsigned int to size_t

Fixes BlueBrain#443
@sanjayankur31
Copy link
Author

Note: I've fixed the issues on i686, but ran into another while testing on armv7hl. I'll have to find a test machine to work on that.

musicinmybrain pushed a commit to musicinmybrain/HighFive that referenced this issue Aug 27, 2021
Explicitly casts long long unsigned int to size_t

Fixes BlueBrain#443
@musicinmybrain
Copy link

Note: I've fixed the issues on i686, but ran into another while testing on armv7hl. I'll have to find a test machine to work on that.

I can confirm sanjayankur31@cca2c74 still fixes i686 on the current release.

For armv7hl, the error is:

In file included from /builddir/build/BUILD/HighFive-2.3.1/include/highfive/bits/H5Node_traits_misc.hpp:29,
                 from /builddir/build/BUILD/HighFive-2.3.1/include/highfive/H5File.hpp:91,
                 from /builddir/build/BUILD/HighFive-2.3.1/src/examples/select_by_id_dataset_cpp11.cpp:14:
/builddir/build/BUILD/HighFive-2.3.1/include/highfive/bits/H5Slice_traits_misc.hpp: In instantiation of 'HighFive::Selection HighFive::SliceTraits<Derivate>::select(const HighFive::ElementSet&) const [with Derivate = HighFive::DataSet]':
/builddir/build/BUILD/HighFive-2.3.1/src/examples/select_by_id_dataset_cpp11.cpp:50:27:   required from here
/builddir/build/BUILD/HighFive-2.3.1/include/highfive/bits/H5Slice_traits_misc.hpp:141:16: error: cast from 'const value_type*' {aka 'const unsigned int*'} to 'const hsize_t*' {aka 'const long long unsigned int*'} increases required alignment of target type [-Werror=cast-align]
  141 |         data = reinterpret_cast<const hsize_t*>(&(elements._ids[0]));
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The problem is here, in

template <typename Derivate>
inline Selection SliceTraits<Derivate>::select(const ElementSet& elements) const {
    const auto& slice = static_cast<const Derivate&>(*this);
    const hsize_t* data = nullptr;
    const DataSpace space = slice.getSpace().clone();
    const std::size_t length = elements._ids.size();
    if (length % space.getNumberDimensions() != 0) {
        throw DataSpaceException("Number of coordinates in elements picking "
                                 "should be a multiple of the dimensions.");
    }
    const std::size_t num_elements = length / space.getNumberDimensions();
    std::vector<hsize_t> raw_elements;

    // optimised at compile time
    // switch for data conversion on 32bits platforms
    if (std::is_same<std::size_t, hsize_t>::value) {
        // `if constexpr` can't be used, thus a reinterpret_cast is needed.
        data = reinterpret_cast<const hsize_t*>(&(elements._ids[0]));
    } else {
        raw_elements.resize(length);
        std::copy(elements._ids.begin(), elements._ids.end(), raw_elements.begin());
        data = raw_elements.data();
    }

    if (H5Sselect_elements(space.getId(), H5S_SELECT_SET, num_elements, data) < 0) {
        HDF5ErrMapper::ToException<DataSpaceException>("Unable to select elements");
    }

    return Selection(DataSpace(num_elements), space, details::get_dataset(slice));
}

While the first branch, with the reinterpret_cast, is never taken on this platform and ought to be optimized out, it is technically still present. Furthermore, the cast may introduce technically-undefined behavior, which could have non-local consequences.

I was able to fix this in musicinmybrain@8b379f7 by introducing an unsightly helper function and using SFINAE to ensure the reinterpret_cast is not compiled at all on platforms where it is not valid. Template metaprogramming tricks are not my specialty, so there may or may not be a nicer way to handle this, but it does seem to do the right thing.


Now the problem on armv7hl is as follows:

In file included from /builddir/build/BUILD/HighFive-2.3.1/include/highfive/H5Easy.hpp:405,
                 from /builddir/build/BUILD/HighFive-2.3.1/tests/unit/tests_high_five_easy.cpp:23:
/builddir/build/BUILD/HighFive-2.3.1/include/highfive/h5easy_bits/H5Easy_opencv.hpp: In instantiation of 'static T H5Easy::detail::io_impl<T, typename std::enable_if<H5Easy::detail::is_opencv<T>::value>::type>::load(const HighFive::File&, const string&) [with T = cv::Mat_<double>; std::string = std::__cxx11::basic_string<char>]':
/builddir/build/BUILD/HighFive-2.3.1/include/highfive/h5easy_bits/H5Easy_public.hpp:163:36:   required from 'T H5Easy::load(const HighFive::File&, const string&) [with T = cv::Mat_<double>; std::string = std::__cxx11::basic_string<char>]'
/builddir/build/BUILD/HighFive-2.3.1/tests/unit/tests_high_five_easy.cpp:465:28:   required from here
/builddir/build/BUILD/HighFive-2.3.1/include/highfive/h5easy_bits/H5Easy_opencv.hpp:70:22: error: cast from 'uchar*' {aka 'unsigned char*'} to 'value_type*' {aka 'double*'} increases required alignment of target type [-Werror=cast-align]
   70 |         dataset.read(reinterpret_cast<value_type*>(data.data));
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/HighFive-2.3.1/include/highfive/h5easy_bits/H5Easy_opencv.hpp: In instantiation of 'static T H5Easy::detail::io_impl<T, typename std::enable_if<H5Easy::detail::is_opencv<T>::value>::type>::loadAttribute(const HighFive::File&, const string&, const string&) [with T = cv::Mat_<double>; std::string = std::__cxx11::basic_string<char>]':
/builddir/build/BUILD/HighFive-2.3.1/include/highfive/h5easy_bits/H5Easy_public.hpp:186:45:   required from 'T H5Easy::loadAttribute(const HighFive::File&, const string&, const string&) [with T = cv::Mat_<double>; std::string = std::__cxx11::basic_string<char>]'
/builddir/build/BUILD/HighFive-2.3.1/tests/unit/tests_high_five_easy.cpp:466:37:   required from here
/builddir/build/BUILD/HighFive-2.3.1/include/highfive/h5easy_bits/H5Easy_opencv.hpp:98:24: error: cast from 'uchar*' {aka 'unsigned char*'} to 'value_type*' {aka 'double*'} increases required alignment of target type [-Werror=cast-align]
   98 |         attribute.read(reinterpret_cast<value_type*>(data.data));
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I haven’t looked into this deeply enough to propose a fix yet.

@musicinmybrain
Copy link

(I can work around this last problem by just not enabling HIGHFIVE_USE_OPENCV on armv7hl, but I haven’t ascertained whether the implementation is actually correct on the other architectures or not.)

sanjayankur31 added a commit to sanjayankur31/HighFive that referenced this issue Apr 6, 2022
Explicitly casts long long unsigned int to size_t

Fixes BlueBrain#443
@alkino
Copy link
Member

alkino commented Apr 13, 2022

We need to take care of new problems

@alkino alkino reopened this Apr 13, 2022
@tnorth
Copy link

tnorth commented Feb 16, 2023

Hi,

It runs for me on PPC32 with the following changes against 4d29dee. I don't know if it introduced new problems as mentioned above, but (some) examples seem to run fine.

diff --git a/include/highfive/bits/H5Slice_traits.hpp b/include/highfive/bits/H5Slice_traits.hpp
index 5ba4e1c..ee00ba5 100644
--- a/include/highfive/bits/H5Slice_traits.hpp
+++ b/include/highfive/bits/H5Slice_traits.hpp
@@ -25,26 +25,26 @@ class ElementSet {
     ///
     /// \param list List of continuous coordinates (e.g.: in 2 dimensions space
     /// `ElementSet{1, 2, 3 ,4}` creates points `(1, 2)` and `(3, 4)`).
-    explicit ElementSet(std::initializer_list<std::size_t> list);
+    explicit ElementSet(std::initializer_list<hsize_t> list);
     ///
     /// \brief Create a list of points of N-dimension for selection.
     ///
     /// \param list List of N-dim points.
-    explicit ElementSet(std::initializer_list<std::vector<std::size_t>> list);
+    explicit ElementSet(std::initializer_list<std::vector<hsize_t>> list);
     ///
     /// \brief Create a list of points of N-dimension for selection.
     ///
     /// \param element_ids List of continuous coordinates (e.g.: in 2 dimensions space
     /// `ElementSet{1, 2, 3 ,4}` creates points `(1, 2)` and `(3, 4)`).
-    explicit ElementSet(const std::vector<std::size_t>& element_ids);
+    explicit ElementSet(const std::vector<hsize_t>& element_ids);
     ///
     /// \brief Create a list of points of N-dimension for selection.
     ///
     /// \param element_ids List of N-dim points.
-    explicit ElementSet(const std::vector<std::vector<std::size_t>>& element_ids);
+    explicit ElementSet(const std::vector<std::vector<hsize_t>>& element_ids);
 
   private:
-    std::vector<std::size_t> _ids;
+    std::vector<hsize_t> _ids;
 
     template <typename Derivate>
     friend class SliceTraits;
@@ -100,9 +100,9 @@ struct RegularHyperSlab {
     }
 
     /// Dimensions when all gaps are removed.
-    std::vector<size_t> packedDims() const {
+    std::vector<hsize_t> packedDims() const {
         auto n_dims = rank();
-        auto dims = std::vector<size_t>(n_dims, 0);
+        auto dims = std::vector<hsize_t>(n_dims, 0);
 
         for (size_t i = 0; i < n_dims; ++i) {
             dims[i] = count[i] * (block.empty() ? 1 : block[i]);
diff --git a/include/highfive/bits/H5Slice_traits_misc.hpp b/include/highfive/bits/H5Slice_traits_misc.hpp
index 2f5ea49..1a5dcdc 100644
--- a/include/highfive/bits/H5Slice_traits_misc.hpp
+++ b/include/highfive/bits/H5Slice_traits_misc.hpp
@@ -48,16 +48,16 @@ inline hid_t get_memspace_id(const DataSet&) {
 }
 }  // namespace details
 
-inline ElementSet::ElementSet(std::initializer_list<std::size_t> list)
+inline ElementSet::ElementSet(std::initializer_list<hsize_t> list)
     : _ids(list) {}
 
-inline ElementSet::ElementSet(std::initializer_list<std::vector<std::size_t>> list)
-    : ElementSet(std::vector<std::vector<std::size_t>>(list)) {}
+inline ElementSet::ElementSet(std::initializer_list<std::vector<hsize_t>> list)
+    : ElementSet(std::vector<std::vector<hsize_t>>(list)) {}
 
-inline ElementSet::ElementSet(const std::vector<std::size_t>& element_ids)
+inline ElementSet::ElementSet(const std::vector<hsize_t>& element_ids)
     : _ids(element_ids) {}
 
-inline ElementSet::ElementSet(const std::vector<std::vector<std::size_t>>& element_ids) {
+inline ElementSet::ElementSet(const std::vector<std::vector<hsize_t>>& element_ids) {
     for (const auto& vec: element_ids) {
         std::copy(vec.begin(), vec.end(), std::back_inserter(_ids));
     }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants