In gcc/: 2000-11-09 Geoffrey Keating <geoffk@redhat.com>
authorGeoffrey Keating <geoffk@redhat.com>
Thu, 9 Nov 2000 21:29:54 +0000 (21:29 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Thu, 9 Nov 2000 21:29:54 +0000 (21:29 +0000)
In gcc/:
2000-11-09  Geoffrey Keating  <geoffk@redhat.com>

* c-decl.c (finish_struct): When a structure is completed,
check all its variant types for completeness.

In gcc/testsuite/:
2000-11-09  Geoffrey Keating  <geoffk@redhat.com>

* gcc.c-torture/compile/20001109-1.c: New test.
* gcc.c-torture/compile/20001109-2.c: New test.

From-SVN: r37346

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20001109-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20001109-2.c [new file with mode: 0644]

index 3db1d11ed18a41fadede4ab4c2ce924ea232f552..03d1ac601455c51937b790d9ccc196f128ea68c5 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-09  Geoffrey Keating  <geoffk@redhat.com>
+
+       * c-decl.c (finish_struct): When a structure is completed,
+       check all its variant types for completeness.
+
 2000-11-09  Neil Booth  <neilb@earthling.net>
 
        * cpphash.c: Move cpp_defined here from cpplib.c.
index 2bbfd4613cea865700db86b8c7e9d0313524b5ef..c1093ceecb9554b2fc3eae3c572d923a9833345d 100644 (file)
@@ -5573,7 +5573,7 @@ finish_struct (t, fieldlist, attributes)
       tree decl;
       for (decl = current_binding_level->names; decl; decl = TREE_CHAIN (decl))
        {
-         if (TREE_TYPE (decl) == t
+         if (TYPE_MAIN_VARIANT (TREE_TYPE (decl)) == TYPE_MAIN_VARIANT (t)
              && TREE_CODE (decl) != TYPE_DECL)
            {
              layout_decl (decl, 0);
index 218023444582f58eb2245baafc0c22aa7df97e62..4a45c4f977149d0375a824731ae015008139c9a9 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-09  Geoffrey Keating  <geoffk@redhat.com>
+
+       * gcc.c-torture/compile/20001109-1.c: New test.
+       * gcc.c-torture/compile/20001109-2.c: New test.
+
 2000-11-09  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.old-deja/g++.pt/operator1.C: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20001109-1.c b/gcc/testsuite/gcc.c-torture/compile/20001109-1.c
new file mode 100644 (file)
index 0000000..cce8047
--- /dev/null
@@ -0,0 +1,7 @@
+typedef struct _foo foo;
+extern foo bar;
+struct _foo {
+  int a;
+};
+
+int tst[__alignof__ (bar) >= __alignof__ (int) ? 1 : -1];
diff --git a/gcc/testsuite/gcc.c-torture/compile/20001109-2.c b/gcc/testsuite/gcc.c-torture/compile/20001109-2.c
new file mode 100644 (file)
index 0000000..a23e56b
--- /dev/null
@@ -0,0 +1,6 @@
+extern struct foo bar;
+struct foo {
+  int a;
+};
+
+int tst[__alignof__ (bar) >= __alignof__ (int) ? 1 : -1];