Re: Clarification on Gcc's strict aliasing rules

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

 



"Segher Boessenkool" <segher@xxxxxxxxxxxxxxxxxxx> writes:

>>> I got no diagnostic when compiling it with "-Wall
>>> -O2" switches. Is it expected ?
>>
>> Yes.  -O0 implies -fno-strict-aliasing.
>
> I misread, you asked for -O2.
>
> The compiler cannot always detect these situations -- if it could,
> it could simply always do what the user expects!
>
> You can try -Wstrict-aliasing=N for different N; levels 1 and 2
> probably work.  The N is a tradeoff between false negatives and
> false positives; see the manual for what they do exactly.

Ok, using levels 1 or 2 gives the diagnostic.

-- 
Francis


[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