aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2003-08-24 00:18:54 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2003-08-24 00:18:54 +0200
commit61c234ce879e13e580cdfa383a59881753add6a8 (patch)
tree78a76c5ec38f223d94c70b1761e375c81455986b /gcc
parentebe75517d4ffdb7045a607c6c5426306dbf662ee (diff)
downloadgcc-61c234ce879e13e580cdfa383a59881753add6a8.zip
gcc-61c234ce879e13e580cdfa383a59881753add6a8.tar.gz
gcc-61c234ce879e13e580cdfa383a59881753add6a8.tar.bz2
c-decl.c (pushdecl): Only put decls which finish_struct will do something about onto incomplete chain.
* c-decl.c (pushdecl): Only put decls which finish_struct will do something about onto incomplete chain. (finish_struct): If not removing type from incomplete list, update prev. * gcc.dg/20030815-1.c: New test. From-SVN: r70752
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/c-decl.c13
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/20030815-1.c26
4 files changed, 47 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f329133..b793413 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2003-08-23 Jakub Jelinek <jakub@redhat.com>
+
+ * c-decl.c (pushdecl): Only put decls which finish_struct will do
+ something about onto incomplete chain.
+ (finish_struct): If not removing type from incomplete
+ list, update prev.
+
Wed Aug 20 12:08:55 CEST 2003 Jan Hubicka <jh@suse.cz>
PR target/11369
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index de4b443..721946e 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1760,8 +1760,10 @@ pushdecl (tree x)
while (TREE_CODE (element) == ARRAY_TYPE)
element = TREE_TYPE (element);
- if (TREE_CODE (element) == RECORD_TYPE
- || TREE_CODE (element) == UNION_TYPE)
+ if ((TREE_CODE (element) == RECORD_TYPE
+ || TREE_CODE (element) == UNION_TYPE)
+ && (TREE_CODE (x) != TYPE_DECL
+ || TREE_CODE (TREE_TYPE (x)) == ARRAY_TYPE))
scope->incomplete = tree_cons (NULL_TREE, x, scope->incomplete);
}
}
@@ -5154,7 +5156,8 @@ finish_struct (tree t, tree fieldlist, tree attributes)
&& TREE_CODE (decl) != TYPE_DECL)
{
layout_decl (decl, 0);
- /* This is a no-op in c-lang.c or something real in objc-act.c. */
+ /* This is a no-op in c-lang.c or something real in
+ objc-act.c. */
if (c_dialect_objc ())
objc_check_decl (decl);
rest_of_decl_compilation (decl, NULL, toplevel, 0);
@@ -5190,7 +5193,11 @@ finish_struct (tree t, tree fieldlist, tree attributes)
else
current_scope->incomplete = TREE_CHAIN (x);
}
+ else
+ prev = x;
}
+ else
+ prev = x;
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0432daf..bfcab55 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2003-08-23 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/20030815-1.c: New test.
+
2003-08-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/3765
diff --git a/gcc/testsuite/gcc.dg/20030815-1.c b/gcc/testsuite/gcc.dg/20030815-1.c
new file mode 100644
index 0000000..fe1e7b4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20030815-1.c
@@ -0,0 +1,26 @@
+/* Test completion of incomplete types.
+ There used to be a bug where some types from incomplete
+ list were accidentally lost. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+typedef struct a A[1];
+typedef struct b B[1];
+typedef struct c C[1];
+typedef struct d D[1];
+typedef struct a E;
+typedef struct b F;
+typedef struct c G;
+typedef struct d H;
+struct a { int a; };
+struct c { int c; };
+struct d { int d; };
+struct b { int b; };
+int sa = sizeof (A);
+int sb = sizeof (B);
+int sc = sizeof (C);
+int sd = sizeof (D);
+int se = sizeof (E);
+int sf = sizeof (F);
+int sg = sizeof (G);
+int sh = sizeof (H);