Linux/ARM: Bus error with -O3 flag of clang/llvm-3.6 while running unit-test of .NET Core
Geunsik Lim via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 11 18:28:44 PDT 2016
>>
>> *(int __attribute__((aligned(1))) *)ptr = 2; // Wrong, attribute
ignored
>>
>>instead you need a typedef:
>>
>> typedef int __atribute__((aligned(1))) unaligned_int;
>> *(unaligned_int *)ptr = 2; // Works
>>
> It does.
It's strange. When I have tried to use "typedef ...." statement with clang
3.6 as you advised,
I have got the build error like below.
BTW, If we use "#pragma clang diagnostic ..." statement to avoid
"attribute ignored" message,
is not it correct? For example,
760 #pragma clang diagnostic push
761 #pragma clang diagnostic ignored "-Wignored-attributes"
762
763 #define __align(x) __attribute__((aligned(x)))
764 inline
765 signed __int32 getI4LittleEndian(const BYTE * ptr)
766 { return *(__align(1) signed __int32*)ptr; }
767
768 inline
769 signed __int64 getI8LittleEndian(const BYTE * ptr)
770 { return *(__align(1) signed __int64*)ptr; }
771
772 #pragma clang diagnostic pop
On Tue, Jul 12, 2016 at 9:36 AM, Tim Northover <t.p.northover at gmail.com>
wrote:
> On 11 July 2016 at 17:21, Geunsik Lim <leemgs at gmail.com> wrote:
> >> If "UNALIGNED" is coming from
> > I have thought that the "UNALIGNED" is coming from
> > https://github.com/dotnet/coreclr/blob/master/src/pal/inc/pal.h (L194 ~
> > L206).
>
> Quite possible, you probably know the code far better than me. It's
> the same in either case though: it's #defined to nothing unless you're
> on x86-64.
>
> >> instead you need a typedef:
> >> typedef int __atribute__((aligned(1))) unaligned_int;
> >> *(unaligned_int *)ptr = 2; // Works
> >
> > Really? Does the latest clang/llvm version also ignore the below
> attribute
> > that you commented?
>
> It does.
>
> Tim.
>
--
http://leemgs.fedorapeople.org
Don't try to avoid pain if you fail.
If you decided to face the challenges in life,
you can gain a lot by giving your best.
Cheolsang Jeong's Book & life
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160712/4c51f911/attachment.html>
More information about the llvm-commits
mailing list