This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/40560] Erroneous aliasing rules message
- From: "yuri at rawbw dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jun 2009 17:16:01 -0000
- Subject: [Bug c++/40560] Erroneous aliasing rules message
- References: <bug-40560-6649@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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