diff mbox

Fix TYPE_PACKED verify_type ICE

Message ID 20151129185841.GD28051@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Nov. 29, 2015, 6:58 p.m. UTC
Hi,
this patch fixes verifier ICE where we have !TYPE_PACKED variant of
TYPE_PACKED type. The fix is symmetric to earlier fix for enums.

Bootstrapped/regtested x86_64-linux, OK?

Honza

	PR c/67106
	* gcc.c-torture/compile/pr67106.c: New testcase.
	* c-decl.c: Set TYPE_PACKED in variants.

Comments

Joseph Myers Nov. 29, 2015, 7:02 p.m. UTC | #1
On Sun, 29 Nov 2015, Jan Hubicka wrote:

> Hi,
> this patch fixes verifier ICE where we have !TYPE_PACKED variant of
> TYPE_PACKED type. The fix is symmetric to earlier fix for enums.
> 
> Bootstrapped/regtested x86_64-linux, OK?
> 
> Honza
> 
> 	PR c/67106
> 	* gcc.c-torture/compile/pr67106.c: New testcase.
> 	* c-decl.c: Set TYPE_PACKED in variants.

OK.
diff mbox

Patch

Index: testsuite/gcc.c-torture/compile/pr67106.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr67106.c	(revision 0)
+++ testsuite/gcc.c-torture/compile/pr67106.c	(revision 0)
@@ -0,0 +1,12 @@ 
+/* { dg-options "-g -fpack-struct" } */
+typedef struct S S;
+
+struct S
+{
+  struct
+  {
+    S *s;
+  };
+  int a;
+};
+
Index: c/c-decl.c
===================================================================
--- c/c-decl.c	(revision 231020)
+++ c/c-decl.c	(working copy)
@@ -7213,7 +7213,8 @@  start_struct (location_t loc, enum tree_
     }
 
   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);