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 #8 from rguenther at suse dot de  2009-04-25 14:20 -------
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, edwintorok at gmail dot com wrote:

> > > >     * 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.
> > 
> 
> Yes, the union has a compatibly type to the one used to store the value (it has
> a char member), hence the union can be used to access the value. I use a
> different member to access the value, but isn't that what unions are for? :)

No, unions are for what in modula or ada are discriminated records, not
for type-punning.  "Manual OO", like the GCC tree union.

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]