From d7b6ba15fd1bbb3a7d66fdfdec9df0014517479d Mon Sep 17 00:00:00 2001 From: Marco Barbone Date: Thu, 9 Jul 2026 12:12:53 -0400 Subject: [PATCH] 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) 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. --- include/xsimd/arch/common/xsimd_common_trigo.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/xsimd/arch/common/xsimd_common_trigo.hpp b/include/xsimd/arch/common/xsimd_common_trigo.hpp index d85511d2e..1a545d78b 100644 --- a/include/xsimd/arch/common/xsimd_common_trigo.hpp +++ b/include/xsimd/arch/common/xsimd_common_trigo.hpp @@ -596,9 +596,9 @@ namespace xsimd { static constexpr std::size_t size = B::size; using value_type = typename B::value_type; - alignas(B) std::array tmp; - alignas(B) std::array txr; - alignas(B) std::array args; + alignas(B::arch_type::alignment()) std::array tmp; + alignas(B::arch_type::alignment()) std::array txr; + alignas(B::arch_type::alignment()) std::array args; x.store_aligned(args.data()); for (std::size_t i = 0; i < size; ++i)