https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67581
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |hubicka at gcc dot
gnu.org
--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The following should fix it:
Index: c-family/c-common.c
===================================================================
--- c-family/c-common.c (revision 230924)
+++ c-family/c-common.c (working copy)
@@ -7787,7 +7787,8 @@ handle_transparent_union_attribute (tree
*node = type = build_duplicate_type (type);
}
- TYPE_TRANSPARENT_AGGR (type) = 1;
+ for (tree t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
+ TYPE_TRANSPARENT_AGGR (t) = 1;
return NULL_TREE;
}
Index: testsuite/g++.dg/torture/pr67581.C
===================================================================
--- testsuite/g++.dg/torture/pr67581.C (revision 0)
+++ testsuite/g++.dg/torture/pr67581.C (revision 0)
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+union U
+{
+ int x;
+ float y;
+} __attribute__ ((__transparent_union__));