[cfe-dev] new warnings

Sebastian Redl sebastian.redl at getdesigned.at
Fri Sep 26 15:02:54 PDT 2008


Florian Weimer wrote:
> * Mike Stump:
>
>   
>> ?  [ toquote the the C rules, as my fingers for some reason didn't  
>> find the C++ rules in seconds ]
>>     
>
> The C++ rules are different.  I think the warning is bogus in C++ mode.
> [basic.lval] rules out most of the strict aliasing analysis, AFAIK.
>   
Here's the 3.10/15, which discusses aliasing:

If a program attempts to access the stored value of an object through an 
lvalue of other than one of the fol-
lowing types the behavior is undefined48):
— the dynamic type of the object,
— a cv-qualified version of the dynamic type of the object,
— a type that is the signed or unsigned type corresponding to the 
dynamic type of the object,
— a type that is the signed or unsigned type corresponding to a 
cv-qualified version of the dynamic type of
    the object,
— an aggregate or union type that includes one of the aforementioned 
types among its members (includ-
    ing, recursively, a member of a subaggregate or contained union),
— a type that is a (possibly cv-qualified) base class type of the 
dynamic type of the object,
— a char or unsigned char type.

48) The intent of this list is to specify those circumstances in which 
an object may or may not be aliased.



More information about the cfe-dev mailing list