Skip to content

Commit 6488be7

Browse files
DiamonDinoiaserge-sans-paille
authored andcommitted
fix(trigo): under-aligned buffers in large-arg range reduction
The generic trigonometric range-reduction kernel stored the batch into std::array buffers declared alignas(B). alignof(B) equals the alignment of the underlying SIMD register, which on some ABIs is smaller than the alignment store_aligned/load_aligned require (A::alignment()). On armhf NEON alignof(batch<float>) is 8 while neon::alignment() is 16, so the buffer was only 8-byte aligned and store_aligned tripped its alignment assertion whenever the stack happened to place it at an 8-mod-16 address. This is exactly what broke the Debian armhf build of 14.2.0 (test '[complex power] pow real complex' -> SIGABRT in store_aligned). Align the buffers to B::arch_type::alignment() instead, matching the convention used by every other internal store_aligned buffer.
1 parent 978d222 commit 6488be7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

include/xsimd/arch/common/xsimd_common_trigo.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,9 @@ namespace xsimd
596596
{
597597
static constexpr std::size_t size = B::size;
598598
using value_type = typename B::value_type;
599-
alignas(B) std::array<value_type, size> tmp;
600-
alignas(B) std::array<value_type, size> txr;
601-
alignas(B) std::array<value_type, size> args;
599+
alignas(B::arch_type::alignment()) std::array<value_type, size> tmp;
600+
alignas(B::arch_type::alignment()) std::array<value_type, size> txr;
601+
alignas(B::arch_type::alignment()) std::array<value_type, size> args;
602602
x.store_aligned(args.data());
603603

604604
for (std::size_t i = 0; i < size; ++i)

0 commit comments

Comments
 (0)