Hi,
in this testcase we ICE on type variant of TYPE_TRANSPARENT_AGGR type
being !TYPE_TRANSPARENT_AGGR.
Bootstrapped/regtested x86_64-linux, OK?
PR c/67581
* g++.dg/torture/pr67581.C: New testcase.
* c-family/c-common.c (handle_transparent_union_attribute): Update
also type variants.
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__));
Index: c-family/c-common.c
===================================================================
--- c-family/c-common.c (revision 231020)
+++ 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;
}