[llvm-dev] Static assert fails when compiler for i386
kamlesh kumar via llvm-dev
llvm-dev at lists.llvm.org
Wed Oct 16 20:57:54 PDT 2019
Hi Devs,
Consider below testcase.
$cat test.cpp
#include <vector>
#include<type_traits>
typedef int _int4 __attribute__((vector_size(16)));
typedef union{
int data[4];
struct {int x, y, z, w;};
_int4 vec;
} int4;
typedef int4 int3;
int main()
{
static_assert(std::alignment_of<int4>::value <= alignof(max_align_t), "over
aligned!");
}
$clang++ -m32
error: static_assert failed due to requirement
'std::alignment_of<int4>::value <= alignof(max_align_t)' "over aligned
it goes smooth when compile for x86_64.
Following changes fixes this.
diff --git a/clang/lib/Headers/__stddef_max_align_t.h
b/clang/lib/Headers/__stddef_max_align_t.h
index e3b439285d0..46f705a09c3 100644
--- a/clang/lib/Headers/__stddef_max_align_t.h
+++ b/clang/lib/Headers/__stddef_max_align_t.h
@@ -21,6 +21,10 @@ typedef struct {
__attribute__((__aligned__(__alignof__(long long))));
long double __clang_max_align_nonce2
__attribute__((__aligned__(__alignof__(long double))));
+ #ifdef __i386__
+ typedef double xx __attribute__((vector_size(16)));
+ xx __clang_max_align_nonce3
__attribute__((__aligned__(__alignof__(xx))));
+ #endif
} max_align_t;
#endif
Like to know community thought on this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191017/8c456137/attachment.html>
More information about the llvm-dev
mailing list