diff options
author | Jakub Jelinek <jakub@redhat.com> | 2001-12-05 15:09:56 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2001-12-05 15:09:56 +0100 |
commit | f79349c75ce20fe02b76edbcf347045181af0fa9 (patch) | |
tree | b441c86d092a48c7430183b19d6c18262c615e50 | |
parent | f71307783a96ca77b876c1ee0e8f3c6a33bc9a6a (diff) | |
download | gcc-f79349c75ce20fe02b76edbcf347045181af0fa9.zip gcc-f79349c75ce20fe02b76edbcf347045181af0fa9.tar.gz gcc-f79349c75ce20fe02b76edbcf347045181af0fa9.tar.bz2 |
c-decl.c (pushdecl): Only increase n_incomplete if pushed decl's type is RECORD_TYPE...
* c-decl.c (pushdecl): Only increase n_incomplete if pushed decl's
type is RECORD_TYPE, UNION_TYPE or ARRAY_TYPE thereof.
(finish_struct): Break the loop if n_incomplete went to 0.
For ARRAY_TYPE, if it is not TYPE_DECL, layout the decl too.
* gcc.c-torture/compile/20011130-1.c: New test.
From-SVN: r47671
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-decl.c | 27 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 |
3 files changed, 35 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a43bbb7..95e2075 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2001-12-05 Jakub Jelinek <jakub@redhat.com> + + * c-decl.c (pushdecl): Only increase n_incomplete if pushed decl's + type is RECORD_TYPE, UNION_TYPE or ARRAY_TYPE thereof. + (finish_struct): Break the loop if n_incomplete went to 0. + For ARRAY_TYPE, if it is not TYPE_DECL, layout the decl too. + Wed Dec 5 07:41:13 2001 Douglas B. Rupp <rupp@gnat.com> * config/alpha/alpha.c (alpha_va_start): Update VMS case. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index b5597f9..2b83f6a 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2491,7 +2491,15 @@ pushdecl (x) incomplete type. */ if (TREE_TYPE (x) != error_mark_node && !COMPLETE_TYPE_P (TREE_TYPE (x))) - ++b->n_incomplete; + { + tree element = TREE_TYPE (x); + + while (TREE_CODE (element) == ARRAY_TYPE) + element = TREE_TYPE (element); + if (TREE_CODE (element) == RECORD_TYPE + || TREE_CODE (element) == UNION_TYPE) + ++b->n_incomplete; + } } /* Put decls on list in reverse order. @@ -5777,7 +5785,8 @@ finish_struct (t, fieldlist, attributes) rest_of_decl_compilation (decl, NULL, toplevel, 0); if (! toplevel) expand_decl (decl); - --current_binding_level->n_incomplete; + if (--current_binding_level->n_incomplete == 0) + break; } else if (!COMPLETE_TYPE_P (TREE_TYPE (decl)) && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) @@ -5786,7 +5795,19 @@ finish_struct (t, fieldlist, attributes) while (TREE_CODE (element) == ARRAY_TYPE) element = TREE_TYPE (element); if (element == t) - layout_array_type (TREE_TYPE (decl)); + { + layout_array_type (TREE_TYPE (decl)); + if (TREE_CODE (decl) != TYPE_DECL) + { + layout_decl (decl, 0); + maybe_objc_check_decl (decl); + rest_of_decl_compilation (decl, NULL, toplevel, 0); + if (! toplevel) + expand_decl (decl); + } + if (--current_binding_level->n_incomplete == 0) + break; + } } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d22c31d..c300901 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-12-05 Jakub Jelinek <jakub@redhat.com> + + * gcc.c-torture/compile/20011130-1.c: New test. + 2001-12-04 Joseph S. Myers <jsm28@cam.ac.uk> * gcc.c-torture/execute/20000722-1.x, |