Skip to content

Commit fcb0855

Browse files
committed
try fix
1 parent f409de3 commit fcb0855

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

cmake/sanitizers.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ if(USE_SANITIZER)
2929
endif()
3030
list(APPEND SANITIZER_COMPILE_OPTIONS -fsanitize=${sanitizer})
3131
list(APPEND SANITIZER_LINK_OPTIONS -fsanitize=${sanitizer})
32+
if (${sanitizer} MATCHES "undefined")
33+
list(APPEND SANITIZER_COMPILE_OPTIONS -fno-sanitize=signed-integer-overflow)
34+
endif()
3235
if (${sanitizer} MATCHES "memory")
3336
list(APPEND SANITIZER_LINK_LIBRARIES -fsanitize-memory-track-origins -fPIE -pie)
3437
list(APPEND SANITIZER_LINK_OPTIONS -fsanitize-memory-track-origins -fPIE -pie)

include/xtensor/core/xstrides.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ namespace xt
171171
It strided_data_end(const C& c, It begin, layout_type l, size_type offset)
172172
{
173173
using difference_type = typename std::iterator_traits<It>::difference_type;
174-
if (c.dimension() == 0)
174+
if (c.dimension() == 0 || c.size() == 0)
175175
{
176176
++begin;
177177
}

include/xtensor/misc/xfft.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace xt
6161
auto odd = radix2(xt::view(ev, xt::range(1, _, 2)));
6262
#endif
6363

64-
auto range = xt::arange<double>(N / 2);
64+
auto range = xt::arange<double>(static_cast<double>(N) / 2);
6565
auto exp = xt::exp(static_cast<value_type>(-2i) * pi * range / N);
6666
auto t = exp * odd;
6767
auto first_half = even + t;
@@ -82,8 +82,8 @@ namespace xt
8282

8383
// Find a power-of-2 convolution length m such that m >= n * 2 + 1
8484
const std::size_t n = data.size();
85-
size_t m = std::ceil(std::log2(n * 2 + 1));
86-
m = std::pow(2, m);
85+
size_t m = static_cast<size_t>(std::ceil(std::log2(n * 2 + 1)));
86+
m = static_cast<size_t>(std::pow(2, m));
8787

8888
// Trignometric table
8989
auto exp_table = xt::xtensor<std::complex<precision>, 1>::from_shape({n});
@@ -162,7 +162,7 @@ namespace xt
162162
if constexpr (xtl::is_complex<typename std::decay<E>::type::value_type>::value)
163163
{
164164
// check the length of the data on that axis
165-
const std::size_t n = e.shape(axis);
165+
const std::size_t n = e.shape(xt::normalize_axis(e.dimension(), axis));
166166
if (n == 0)
167167
{
168168
XTENSOR_THROW(std::runtime_error, "Cannot take the iFFT along an empty dimention");

0 commit comments

Comments
 (0)