<div dir="ltr">>><br style="font-size:12.8px">>><span style="font-size:12.8px">   *(int __attribute__((aligned(1))) *)ptr = 2; // Wrong, attribute ignored</span><br style="font-size:12.8px">>><br style="font-size:12.8px">>><span style="font-size:12.8px">instead you need a typedef:</span><br style="font-size:12.8px">>><br style="font-size:12.8px">>><span style="font-size:12.8px">   typedef int __atribute__((aligned(1))) unaligned_int;</span><br style="font-size:12.8px">>><span style="font-size:12.8px">   *(unaligned_int *)ptr = 2; // Works</span><div><span style="font-size:12.8px">>><br></span>> <span style="font-size:12.8px">It does.</span><br><br>It's strange. When I have tried to use "typedef ...." statement with clang 3.6 as you advised, </div><div>I have got the build error like below. <br><br><br><span style="font-size:12.8px">BTW, If we use "#pragma clang diagnostic ..." statement to avoid  "attribute ignored" message, </span><br><span style="font-size:12.8px">is not it correct? For example, </span><br><div style=""><span style="font-size:12.8px">                         </span></div><div style=""><span style="font-size:12.8px"> 760 #pragma clang diagnostic push                          </span></div><div style=""><span style="font-size:12.8px"> 761 #pragma clang diagnostic ignored "-Wignored-attributes"</span></div><div style=""><span style="font-size:12.8px"> 762                             </span></div><div style=""><span style="font-size:12.8px"> 763 #define __align(x)      __attribute__((aligned(x)))                                    </span></div><div style=""><span style="font-size:12.8px"> 764 inline</span></div><div style=""><span style="font-size:12.8px"> 765   signed __int32    getI4LittleEndian(const BYTE * ptr)</span></div><div style=""><span style="font-size:12.8px"> 766 { return *(__align(1) signed __int32*)ptr; }</span></div><div style=""><span style="font-size:12.8px"> 767  </span></div><div style=""><span style="font-size:12.8px"> 768 inline</span></div><div style=""><span style="font-size:12.8px"> 769   signed __int64    getI8LittleEndian(const BYTE * ptr)</span></div><div style=""><span style="font-size:12.8px"> 770 { return *(__align(1) signed __int64*)ptr; }</span></div><div style=""><span style="font-size:12.8px"> 771  </span></div><div style=""><span style="font-size:12.8px"> 772 #pragma clang diagnostic pop</span></div><div style="font-size:12.8px"><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 12, 2016 at 9:36 AM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 11 July 2016 at 17:21, Geunsik Lim <<a href="mailto:leemgs@gmail.com">leemgs@gmail.com</a>> wrote:<br>
>> If "UNALIGNED" is coming from<br>
</span><span class="">> I have thought that the "UNALIGNED"  is coming from<br>
> <a href="https://github.com/dotnet/coreclr/blob/master/src/pal/inc/pal.h" rel="noreferrer" target="_blank">https://github.com/dotnet/coreclr/blob/master/src/pal/inc/pal.h</a> (L194 ~<br>
> L206).<br>
<br>
</span>Quite possible, you probably know the code far better than me. It's<br>
the same in either case though: it's #defined to nothing unless you're<br>
on x86-64.<br>
<span class=""><br>
>> instead you need a typedef:<br>
>>   typedef int __atribute__((aligned(1))) unaligned_int;<br>
>>   *(unaligned_int *)ptr = 2; // Works<br>
><br>
> Really? Does the latest clang/llvm version also  ignore the below attribute<br>
> that you commented?<br>
<br>
</span>It does.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><a href="http://leemgs.fedorapeople.org" style="font-family:Tahoma" target="_blank">http://leemgs.fedorapeople.org</a><span style="font-family:Tahoma"> </span></div><div>Don't try to avoid pain if you fail.<br>If you decided to face the challenges in life, <br>you can gain a lot by giving your best.<br>Cheolsang Jeong's Book & life<br>--<br></div></div></div>
</div>