This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix TYPE_PACKED verify_type ICE
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org, rguenther at suse dot de, joseph at codesourcery dot com
- Date: Sun, 29 Nov 2015 19:58:41 +0100
- Subject: Fix TYPE_PACKED verify_type ICE
- Authentication-results: sourceware.org; auth=none
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.
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);