PR c/67106
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 29 Nov 2015 19:50:04 +0000 (19:50 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 29 Nov 2015 19:50:04 +0000 (19:50 +0000)
* gcc.c-torture/compile/pr67106.c: New testcase.
* c-decl.c: Set TYPE_PACKED in variants.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231049 138bc75d-0d04-0410-961f-82ee72b054a4

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 ffa365c..0655aef 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 7b9ab8a..31de0a5 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 a4419b8..23da95f 100644 (file)
@@ -1,5 +1,10 @@
 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
        * g++.dg/torture/pr67581.C: New testcase.
 
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;
+};
+