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 middle-end/39895] gcc-4.4 -Wstrict-aliasing and -Wstrict-aliasing=3 behaves like -Wstrict-aliasing=2 in gcc-4.3



------- Comment #5 from rguenther at suse dot de  2009-04-25 14:12 -------
Subject: Re:  gcc-4.4 -Wstrict-aliasing and
 -Wstrict-aliasing=3 behaves like -Wstrict-aliasing=2 in gcc-4.3

On Sat, 25 Apr 2009, Richard Guenther wrote:

> On Sat, 25 Apr 2009, edwintorok at gmail dot com wrote:
> 
> > 
> > 
> > ------- Comment #2 from edwintorok at gmail dot com  2009-04-25 13:49 -------
> > (In reply to comment #1)
> > > Casting through a union (2)
> > > 
> > > describes an invalid way of doing type-punning.
> > 
> > There is also a citation from C99 on that page:
> > "An object shall have its stored value accessed only by an lvalue expression
> > that has one of the following types:
> > 
> >     * 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."
> > 
> > I'm casting to a union that has both types as members, why doesn't that fit
> > under the 5th case in the above quote?
> 
> Because it is certainly backwards.

Or rather, this refers to a compatible type to the type that was used
to store the value, so it doesn't apply to type-punning.

Richard.


-- 


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


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