re PR c++/67581 (ICE on transparent union with -g enabled on x86_64-linux-gnu (verify...
authorJan Hubicka <hubicka@ucw.cz>
Sun, 29 Nov 2015 19:48:45 +0000 (20:48 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 29 Nov 2015 19:48:45 +0000 (19:48 +0000)
PR c/67581
* g++.dg/torture/pr67581.C: New testcase.
* c-family/c-common.c (handle_transparent_union_attribute): Update
also type variants.

From-SVN: r231048

gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr67581.C [new file with mode: 0644]

index ad0fbc1c73559485f4608cc49fc91866d371393c..f8fa0b2b376aeed7e50d8e03cb83005fad2f21bb 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-29  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR c/67581
+       * c-common.c (handle_transparent_union_attribute): Update
+       also type variants.
+
 2015-11-27  Martin Liska  <mliska@suse.cz>
 
        PR c++/68312
index fe0a235988fe88a0e9020724b5b1f60df19945f7..369574f44de697220bb91cf0d4a0a82431a117fd 100644 (file)
@@ -7787,7 +7787,8 @@ handle_transparent_union_attribute (tree *node, tree name,
          *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 d58666e1bf9bbc3b9c19c386a64460b067213a54..a4419b8acb45d75f6bfbd02591df2b860347b8a8 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-29  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR c/67581
+       * g++.dg/torture/pr67581.C: New testcase.
+
 2015-11-27  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/68559
diff --git a/gcc/testsuite/g++.dg/torture/pr67581.C b/gcc/testsuite/g++.dg/torture/pr67581.C
new file mode 100644 (file)
index 0000000..8089c1f
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+union U 
+{
+  int x; 
+  float y;
+} __attribute__ ((__transparent_union__));