re PR c/67106 (ICE: verify_type failed: type variant differs by TYPE_PACKED. with...
authorJan Hubicka <hubicka@ucw.cz>
Sun, 29 Nov 2015 19:50:04 +0000 (20:50 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 29 Nov 2015 19:50:04 +0000 (19:50 +0000)
PR c/67106
* gcc.c-torture/compile/pr67106.c: New testcase.
* c-decl.c: Set TYPE_PACKED in variants.

From-SVN: r231049

gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr67106.c [new file with mode: 0644]

index ffa365c1f7231e82ef8c4a06edb99a9410a88e7d..0655aef6c19dc8bde72f26469ed726b00e74a8bc 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-29  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR c/67106
+       * c-decl.c: Set TYPE_PACKED in variants.
+
 2015-11-27  Martin Liska  <mliska@suse.cz>
 
        PR c++/68312
index 7b9ab8ae6466d923d220ee67c9dd47bd579b332e..31de0a51e56431b0fd0efde6c91f1a71054d2116 100644 (file)
@@ -7213,7 +7213,8 @@ start_struct (location_t loc, enum tree_code code, tree name,
     }
 
   C_TYPE_BEING_DEFINED (ref) = 1;
-  TYPE_PACKED (ref) = flag_pack_struct;
+  for (tree v = TYPE_MAIN_VARIANT (ref); v; v = TYPE_NEXT_VARIANT (v))
+    TYPE_PACKED (v) = flag_pack_struct;
 
   *enclosing_struct_parse_info = struct_parse_info;
   struct_parse_info = XNEW (struct c_struct_parse_info);
index a4419b8acb45d75f6bfbd02591df2b860347b8a8..23da95f08e86125a7728ad33b8090c29af1bd4db 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-29  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR c/67106
+       * gcc.c-torture/compile/pr67106.c: New testcase.
+
 2015-11-29  Jan Hubicka  <hubicka@ucw.cz>
 
        PR c/67581
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr67106.c b/gcc/testsuite/gcc.c-torture/compile/pr67106.c
new file mode 100644 (file)
index 0000000..2a003e5
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-options "-g -fpack-struct" } */
+typedef struct S S;
+
+struct S
+{
+  struct
+  {
+    S *s;
+  };
+  int a;
+};
+