diff --git a/libcxx/include/experimental/__simd/vec_ext.h b/libcxx/include/experimental/__simd/vec_ext.h index ce60a4c6c0fd35c..d65f524060fc9c5 100644 --- a/libcxx/include/experimental/__simd/vec_ext.h +++ b/libcxx/include/experimental/__simd/vec_ext.h @@ -37,7 +37,11 @@ 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))))); + // This doesn't work in GCC if it is directly inside the __vector_size__ attribute because of a call to + // __builtin_is_constant_evaluated. See 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");