<div dir="ltr">Thank you, Rui for clarification.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 17, 2019 at 10:25 AM Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">max_align_t is a type whose alignment requirement is as large as any <i>scalar</i> type, but your int4 is not a scalar type but a union containing a vector _int4, so it looks like your assertion is simply incorrect.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 17, 2019 at 12:58 PM kamlesh kumar via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Devs,<div>Consider below testcase.</div><div>$cat test.cpp</div><div><div style="color:rgb(0,0,0);background-color:rgb(255,255,254)"><div><span style="color:rgb(0,0,255)">#include</span> <span style="color:rgb(0,0,255)"><</span><span style="color:rgb(163,21,21)">vector</span><span style="color:rgb(0,0,255)">></span></div><div><span style="color:rgb(0,0,255)">#include<</span><span style="color:rgb(163,21,21)">type_traits</span><span style="color:rgb(0,0,255)">></span></div><div><span style="color:rgb(0,0,255)">typedef</span> <span style="color:rgb(0,0,255)">int</span> _int4 __attribute__((vector_size(<span style="color:rgb(9,136,90)">16</span>)));</div><div><span style="color:rgb(0,0,255)">typedef</span> <span style="color:rgb(0,0,255)">union</span>{</div><div> <span style="color:rgb(0,0,255)">int</span> data[<span style="color:rgb(9,136,90)">4</span>];</div><div> <span style="color:rgb(0,0,255)">struct</span> {<span style="color:rgb(0,0,255)">int</span> x, y, z, w;};</div><div> _int4 vec;</div><div>} int4;</div><div><span style="color:rgb(0,0,255)">typedef</span> int4 int3;</div><div><span style="color:rgb(0,0,255)">int</span> main()</div><div>{</div><div> <span style="color:rgb(0,0,255)">static_assert</span>(std::alignment_of<int4>::value <= <span style="color:rgb(0,0,255)">alignof</span>(max_align_t), <span style="color:rgb(163,21,21)">"over aligned!"</span>);</div><div>}</div><div><br></div><div>$clang++ -m32 </div><div><span style="box-sizing:border-box;font-weight:bolder;color:rgb(0,123,253);font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:11.6667px;white-space:pre-wrap;background-color:rgb(255,255,255)"><span style="box-sizing:border-box;color:rgb(170,0,0)">error: </span></span><span style="box-sizing:border-box;font-weight:bolder;color:rgb(0,123,253);font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:11.6667px;white-space:pre-wrap;background-color:rgb(255,255,255)">static_assert failed due to requirement 'std::alignment_of<int4>::value <= alignof(max_align_t)' "over aligned</span><br></div><div>it goes smooth when compile for x86_64.</div><div>Following changes fixes this.</div><div><br></div><div>diff --git a/clang/lib/Headers/__stddef_max_align_t.h b/clang/lib/Headers/__stddef_max_align_t.h<br>index e3b439285d0..46f705a09c3 100644<br>--- a/clang/lib/Headers/__stddef_max_align_t.h<br>+++ b/clang/lib/Headers/__stddef_max_align_t.h<br>@@ -21,6 +21,10 @@ typedef struct {<br> __attribute__((__aligned__(__alignof__(long long))));<br> long double __clang_max_align_nonce2<br> __attribute__((__aligned__(__alignof__(long double))));<br>+ #ifdef __i386__<br>+ typedef double xx __attribute__((vector_size(16)));<br>+ xx __clang_max_align_nonce3 __attribute__((__aligned__(__alignof__(xx))));<br>+ #endif<br> } max_align_t;<br> #endif<br> <br></div><div>Like to know community thought on this?</div></div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div>