commit 44161aee4d2f1c97260afce0e25a91831d86e91e
parent d25a43ed046b086ad3601be1af10e173333552ee
Author: bmanga <bruno.manga95@gmail.com>
Date: Tue, 9 Jul 2019 14:23:32 +0100
Added workaround for gcc9 alignas bug
Diffstat:
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/kfr/simd/constants.hpp b/include/kfr/simd/constants.hpp
@@ -88,6 +88,9 @@ public:
using Tsub = subtype<T>;
};
+template <size_t Value>
+constexpr size_t force_compiletime_size_t = Value;
+
CMT_PRAGMA_GNU(GCC diagnostic pop)
/// π (pi)
diff --git a/include/kfr/simd/impl/simd.hpp b/include/kfr/simd/impl/simd.hpp
@@ -23,6 +23,7 @@
#pragma once
#include "../platform.hpp"
+#include "../constants.hpp"
namespace kfr
{
@@ -67,13 +68,13 @@ constexpr size_t alignment()
}
template <typename T, size_t N>
-struct alignas(alignment<T, N>()) simd_array
+struct alignas(force_compiletime_size_t<alignment<T, N>()>) simd_array
{
T val[next_poweroftwo(N)];
};
template <typename T, size_t N>
-struct alignas(alignment<T, N>()) simd_array<bit<T>, N>
+struct alignas(force_compiletime_size_t<alignment<T, N>()>) simd_array<bit<T>, N>
{
bit_value<T> val[next_poweroftwo(N)];
};
diff --git a/include/kfr/simd/vec.hpp b/include/kfr/simd/vec.hpp
@@ -162,11 +162,11 @@ struct compoundcast<vec<vec<T, N1>, N2>>
} // namespace internal
template <typename T, size_t N>
-struct alignas(const_max(alignof(intrinsics::simd<typename compound_type_traits<T>::deep_subtype,
+struct alignas(force_compiletime_size_t<const_max(alignof(intrinsics::simd<typename compound_type_traits<T>::deep_subtype,
N * compound_type_traits<T>::deep_width>),
const_min(size_t(platform<>::native_vector_alignment),
next_poweroftwo(sizeof(typename compound_type_traits<T>::deep_subtype) *
- N * compound_type_traits<T>::deep_width)))) vec
+ N * compound_type_traits<T>::deep_width)))>) vec
{
static constexpr vec_shape<T, N> shape() CMT_NOEXCEPT { return {}; }