Re: aliasing issue after automatic inlining

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Apr 20, 2011, at 2:29 AM, Ian Lance Taylor wrote:

[...]

> This code is accessing values of type int using a pointer of type
> short*.  That is invalid aliasing and your program uses undefined
> behaviour.  Your suggested workarounds are the right one.
> 
> To get a warning, you could try the -Wstrict-aliasing option.  I don't
> think it exists in gcc 4.2, though.

I tried with -Wstrict-aliasing, -Wstrict-aliasing=1..2 and -Wstrict-aliasing=3 with gcc 4.6, but didn't get a warning. This is a little bit annoying as it just happens after the implicit optimization/inlining. Declaring struct s as volatile or compiling with -fno-inline-functions helps, too. However, I'll stick with -fno-strict-aliasing.

-Felix



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux