Skip to content

Commit

Permalink
Avoid spurious GCC 13 array-bounds warnings.
Browse files Browse the repository at this point in the history
Prior to this commit GCC 13 would emit numerous warnings related to
`-Warray-bounds`. There are numerous similar have been reported, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456

This PR replaces the `std::copy` with the equivalent loop.
  • Loading branch information
1uc committed Jul 28, 2023
1 parent 2f5dc7d commit f3efc6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/highfive/bits/H5Inspector_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <type_traits>
#include <cstring>
#include <cassert>
#include <numeric>

#include "../H5Reference.hpp"
Expand Down Expand Up @@ -369,7 +370,10 @@ struct inspector<std::vector<T>> {
sizes[0] = val.size();
if (!val.empty()) {
auto s = inspector<value_type>::getDimensions(val[0]);
std::copy(s.begin(), s.end(), sizes.begin() + 1);
assert(s.size() + ndim == sizes.size());
for(size_t i = 0; i < s.size(); ++i) {
sizes[i+ndim] = s[i];
}
}
return sizes;
}
Expand Down

0 comments on commit f3efc6b

Please sign in to comment.