decl.c (cp_finish_decl): Make sure array types are laid out, even if the array bounds...
authorMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 2 Oct 2002 01:16:22 +0000 (01:16 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 2 Oct 2002 01:16:22 +0000 (01:16 +0000)
* decl.c (cp_finish_decl): Make sure array types are laid out,
even if the array bounds are unknown.

From-SVN: r57717

gcc/cp/ChangeLog
gcc/cp/decl.c

index 1c9e5a661f847bdb0c362e7e6bb46e0db937adb7..e78f0c2b342862970669d7f3ea01e743e04797df 100644 (file)
@@ -1,10 +1,18 @@
+2002-10-01  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (cp_finish_decl): Make sure array types are laid out,
+       even if the array bounds are unknown.
+
 2002-10-01  Steve Ellcey  <sje@cup.hp.com>
 
-       * cp/class.c (build_vtbl_initializer): Change build_c_cast
+       * class.c (build_vtbl_initializer): Change build_c_cast
        to build1.
 
 2002-10-01  Mark Mitchell  <mark@codesourcery.com>
 
+       * decl.c (cp_finish_decl): Make sure array types are laid out,
+       even if the array bounds are unknown.
+
        * decl.c (cp_finish_decl): Correct check for dynamic
        initialization of thread-local storage.
 
index eec8bbb8baa51d5c2678a0bc3ec7c14fd97e1af5..7375fde724013c5d795b7d22b7e9f5a85eddf7b6 100644 (file)
@@ -8253,6 +8253,12 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
             taken place.  */
          DECL_INITIALIZED_P (decl) = 1;
        }
+      /* If the variable has an array type, lay out the type, even if
+        there is no initializer.  It is valid to index through the
+        array, and we must get TYPE_ALIGN set correctly on the array
+        type.  */
+      else if (TREE_CODE (type) == ARRAY_TYPE)
+       layout_type (type);
     }
 
   /* Add this declaration to the statement-tree.  This needs to happen