Re: Clarification on Gcc's strict aliasing rules

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

 



Ian Lance Taylor <iant@xxxxxxxxxx> writes:

> "Segher Boessenkool" <segher@xxxxxxxxxxxxxxxxxxx> writes:
>
>>> BTW, I tried to compile the last example, and we agreed that it invokes
>>> undefined behaviour.
>>
>> I did no such thing.  With -fno-strict-aliasing, the code is well-defined.
>
> I think I would say this slightly differently.  The code is still
> undefined according to the C/C++ language standards.  When you use
> -fno-strict-aliasing, gcc is promising to avoid using a class of
> optimizations based on those portions of the language standards.
> Another way to say this is that gcc is promising to not optimize based
> on the fact that memory locations are accessed using different types.
> That is, the code is still incorrect; gcc is just avoiding a class of
> optimizations which are known to cause trouble with real programs.
>
> I also am having trouble understanding what the OP is asking for here.

Clarification on GCC's strict aliasing rules.

But I think I got it now, although I still don't know which exactly
undefined behaviours are defined by GCC's -fno-strict-aliasing.

Thanks
-- 
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