This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/40560] Erroneous aliasing rules message



------- Comment #2 from yuri at rawbw dot com  2009-06-26 17:16 -------
Subject: Re:  Erroneous aliasing rules message

pinskia at gcc dot gnu dot org wrote:
> ------- Comment #1 from pinskia at gcc dot gnu dot org  2009-06-26 16:47 -------
> I don't think this is a bogus warning message as you reading a character via Z
> which is undefined. (the opposite way is defined though)

ISO/IEC 9899, chapter 6.5 paragraph 7 says:
--- begin quote ---
An object shall have its stored value accessed only by an lvalue 
expression that has one of
the following types:74)
? a type compatible with the effective type of the object,
? a qualified version of a type compatible with the effective type of 
the object,
? a type that is the signed or unsigned type corresponding to the 
effective type of the
object,
? a type that is the signed or unsigned type corresponding to a 
qualified version of the
effective type of the object,
? an aggregate or union type that includes one of the aforementioned 
types among its
members (including, recursively, a member of a subaggregate or contained 
union), or
? a character type.
--- end quote ---

So in my example char and Z are unioned. Therefore I believe typecast 
should be allowed.

Yuri


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40560


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]