http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54342
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |4.8.0 --- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-08-21 11:08:27 UTC --- > diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c > index 53554a9..bb39e7f 100644 > --- a/gcc/stor-layout.c > +++ b/gcc/stor-layout.c > @@ -1639,7 +1639,8 @@ compute_record_mode (tree type) > /* If we only have one real field; use its mode if that mode's size > matches the type's size. This only applies to RECORD_TYPE. This > does not apply to unions. */ > - if (TREE_CODE (type) == RECORD_TYPE && mode != VOIDmode > + if ((TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE) > + && mode != VOIDmode > && host_integerp (TYPE_SIZE (type), 1) > && GET_MODE_BITSIZE (mode) == TREE_INT_CST_LOW (TYPE_SIZE (type))) > SET_TYPE_MODE (type, mode); Reading the comment immediately makes the patch suspicious.