From a4850ce9b58d12158248dc7fbe1015646757c813 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 29 Nov 2015 20:50:04 +0100 Subject: [PATCH] re PR c/67106 (ICE: verify_type failed: type variant differs by TYPE_PACKED. with -g -fpack-struct) 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 | 5 +++++ gcc/c/c-decl.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr67106.c | 12 ++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr67106.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index ffa365c1f72..0655aef6c19 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2015-11-29 Jan Hubicka + + PR c/67106 + * c-decl.c: Set TYPE_PACKED in variants. + 2015-11-27 Martin Liska PR c++/68312 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 7b9ab8ae646..31de0a51e56 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a4419b8acb4..23da95f08e8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-11-29 Jan Hubicka + + PR c/67106 + * gcc.c-torture/compile/pr67106.c: New testcase. + 2015-11-29 Jan Hubicka 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 index 00000000000..2a003e56f2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr67106.c @@ -0,0 +1,12 @@ +/* { dg-options "-g -fpack-struct" } */ +typedef struct S S; + +struct S +{ + struct + { + S *s; + }; + int a; +}; + -- 2.30.2