From cbe2a7c8d1d5ef79cb2a2bc058af0869bf93cccb Mon Sep 17 00:00:00 2001 From: Mital Ashok Date: Sun, 8 Sep 2024 07:22:36 +0100 Subject: [PATCH] Workaround for GCC bug for __builtin_is_constant_evaluated when evaluating attribute argument --- libcxx/include/experimental/__simd/vec_ext.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libcxx/include/experimental/__simd/vec_ext.h b/libcxx/include/experimental/__simd/vec_ext.h index ce60a4c6c0fd35..22e6b0992231eb 100644 --- a/libcxx/include/experimental/__simd/vec_ext.h +++ b/libcxx/include/experimental/__simd/vec_ext.h @@ -37,7 +37,10 @@ inline constexpr bool is_abi_tag_v> = _Np > 0 && _Np <= template struct __simd_storage<_Tp, simd_abi::__vec_ext<_Np>> { - _Tp __data __attribute__((__vector_size__(std::__bit_ceil((sizeof(_Tp) * _Np))))); + // Workaround for GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105233 + static constexpr size_t __vector_size = std::__bit_ceil((sizeof(_Tp) * _Np)); + + _Tp __data __attribute__((__vector_size__(__vector_size))); _LIBCPP_HIDE_FROM_ABI _Tp __get(size_t __idx) const noexcept { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < _Np, "Index is out of bounds");