[Bug c/58303] C99 union initializers new union members clobber earlier data

2013-09-03 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58303

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek jakub at gcc dot gnu.org ---
In C99, only one union member may be active at a time, assignment to one of
union members invalidates all the others.  So I don't see anything wrong on
this.


[Bug c/58303] C99 union initializers new union members clobber earlier data

2013-09-03 Thread mpolacek at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58303

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |INVALID

--- Comment #2 from Marek Polacek mpolacek at gcc dot gnu.org ---
An initializer for an union is a single value.  In C89, only the first member
of a union can be initialized; in C99/C11 you can use the designated
initializers to specify which member to initialize, but still only a single
member of an union can be initialized.