diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-01-29 21:37:25 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-01-29 21:37:25 +0100 |
commit | 3a5d2ba4fc106dd53470c5cc52c8262e36e905d2 (patch) | |
tree | 4367b9872f4f3bbdbb24397059002c623515eb61 /gcc | |
parent | c661a43de31bda50ad0c86985c3e17524ed237c0 (diff) | |
download | gcc-3a5d2ba4fc106dd53470c5cc52c8262e36e905d2.zip gcc-3a5d2ba4fc106dd53470c5cc52c8262e36e905d2.tar.gz gcc-3a5d2ba4fc106dd53470c5cc52c8262e36e905d2.tar.bz2 |
re PR debug/69518 (Flag -g causes "error: type variant has different TYPE_VFIELD")
PR debug/69518
* c-decl.c (finish_struct): Clear C_TYPE_INCOMPLETE_VARS in
all type variants, not just TYPE_MAIN_VARIANT.
* gcc.dg/torture/pr69518.c: New test.
From-SVN: r232998
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr69518.c | 11 |
4 files changed, 32 insertions, 11 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 5341f04..606b63c 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2016-01-29 Jakub Jelinek <jakub@redhat.com> + + PR debug/69518 + * c-decl.c (finish_struct): Clear C_TYPE_INCOMPLETE_VARS in + all type variants, not just TYPE_MAIN_VARIANT. + 2016-01-27 Jakub Jelinek <jakub@redhat.com> PR debug/66869 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 502fa5c..aaccaa8 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -7842,6 +7842,14 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, } } + /* Note: C_TYPE_INCOMPLETE_VARS overloads TYPE_VFIELD which is used + in dwarf2out via rest_of_decl_compilation below and means + something totally different. Since we will be clearing + C_TYPE_INCOMPLETE_VARS shortly after we iterate through them, + clear it ahead of time and avoid problems in dwarf2out. Ideally, + C_TYPE_INCOMPLETE_VARS should use some language specific + node. */ + tree incomplete_vars = C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t)); for (x = TYPE_MAIN_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x)) { TYPE_FIELDS (x) = TYPE_FIELDS (t); @@ -7849,6 +7857,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, C_TYPE_FIELDS_READONLY (x) = C_TYPE_FIELDS_READONLY (t); C_TYPE_FIELDS_VOLATILE (x) = C_TYPE_FIELDS_VOLATILE (t); C_TYPE_VARIABLE_SIZE (x) = C_TYPE_VARIABLE_SIZE (t); + C_TYPE_INCOMPLETE_VARS (x) = NULL_TREE; } /* If this was supposed to be a transparent union, but we can't @@ -7862,17 +7871,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, } /* If this structure or union completes the type of any previous - variable declaration, lay it out and output its rtl. - - Note: C_TYPE_INCOMPLETE_VARS overloads TYPE_VFIELD which is used - in dwarf2out via rest_of_decl_compilation below and means - something totally different. Since we will be clearing - C_TYPE_INCOMPLETE_VARS shortly after we iterate through them, - clear it ahead of time and avoid problems in dwarf2out. Ideally, - C_TYPE_INCOMPLETE_VARS should use some language specific - node. */ - tree incomplete_vars = C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t)); - C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t)) = 0; + variable declaration, lay it out and output its rtl. */ for (x = incomplete_vars; x; x = TREE_CHAIN (x)) { tree decl = TREE_VALUE (x); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4d8fa23..aa3855f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-29 Jakub Jelinek <jakub@redhat.com> + + PR debug/69518 + * gcc.dg/torture/pr69518.c: New test. + 2016-01-29 H.J. Lu <hongjiu.lu@intel.com> PR target/69530 diff --git a/gcc/testsuite/gcc.dg/torture/pr69518.c b/gcc/testsuite/gcc.dg/torture/pr69518.c new file mode 100644 index 0000000..b2e7f55 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69518.c @@ -0,0 +1,11 @@ +/* PR debug/69518 */ +/* { dg-do compile } */ +/* { dg-options "-g" } */ + +struct A a; +typedef struct A B; +struct A {} +foo (B x) +{ + __builtin_abort (); +} |