https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88955

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-01-22
                 CC|                            |hjl.tools at gmail dot com,
                   |                            |jsm28 at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm.  I guess the "issue" is that the union has TImode rather than V2DImode.
stor-layout doesn't look at TYPE_TRANSPARENT_AGGR at all though.  Relevant
is

  /* If we only have one real field; use its mode if that mode's size
     matches the type's size.  This generally only applies to RECORD_TYPE.
     For UNION_TYPE, if the widest field is MODE_INT then use that mode.
     If the widest field is MODE_PARTIAL_INT, and the union will be passed
     by reference, then use that mode.  */
  poly_uint64 type_size;
  if ((TREE_CODE (type) == RECORD_TYPE
       || (TREE_CODE (type) == UNION_TYPE
           && (GET_MODE_CLASS (mode) == MODE_INT
               || (GET_MODE_CLASS (mode) == MODE_PARTIAL_INT
                   && targetm.calls.pass_by_reference (pack_cumulative_args
(0),
                                                       mode, type, 0)))))
      && mode != VOIDmode
      && poly_int_tree_p (TYPE_SIZE (type), &type_size)
      && known_eq (GET_MODE_BITSIZE (mode), type_size))
    ;
  else
    mode = mode_for_size_tree (TYPE_SIZE (type), MODE_INT, 1).else_blk ();

where we reject vector modes.  The C++ diagnostic is a bit more clear:

> g++ t.c -S
t.c:5:1: error: type transparent ‘union<anonymous>’ cannot be made transparent
because the type of the first field has a different ABI from the class overall
 {
 ^

which hints at the implementation of the argument passing being the culprit
for the restriction (not sure why the ABI of the class overall should matter
given the docs of transparent_union say the ABI is specified by the first
field...)

Reply via email to