aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2002-04-02 12:00:30 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2002-04-02 07:00:30 -0500
commita14713223feae48a1a8c6b5883e9fedcfce44894 (patch)
treefa0d60aadbc1e4eb5c5c7d47e9d9b0f971548fdb
parentc8b947688ff5b2a16d7b79a8c8cc1170cc0c227e (diff)
downloadgcc-a14713223feae48a1a8c6b5883e9fedcfce44894.zip
gcc-a14713223feae48a1a8c6b5883e9fedcfce44894.tar.gz
gcc-a14713223feae48a1a8c6b5883e9fedcfce44894.tar.bz2
stor-layout.c (layout_type, [...]): Give one-element array the same mode as its component.
* stor-layout.c (layout_type, case ARRAY_TYPE): Give one-element array the same mode as its component. From-SVN: r51745
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/stor-layout.c9
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8fa21c4..3cb11a0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Tue Apr 2 06:47:40 2002 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * stor-layout.c (layout_type, case ARRAY_TYPE): Give one-element array
+ the same mode as its component.
+
2002-04-02 Richard Henderson <rth@redhat.com>
PR opt/190
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 8295000..baf26dd 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1584,8 +1584,13 @@ layout_type (type)
&& (TYPE_MODE (TREE_TYPE (type)) != BLKmode
|| TYPE_NO_FORCE_BLK (TREE_TYPE (type))))
{
- TYPE_MODE (type)
- = mode_for_size_tree (TYPE_SIZE (type), MODE_INT, 1);
+ /* One-element arrays get the component type's mode. */
+ if (simple_cst_equal (TYPE_SIZE (type),
+ TYPE_SIZE (TREE_TYPE (type))))
+ TYPE_MODE (type) = TYPE_MODE (TREE_TYPE (type));
+ else
+ TYPE_MODE (type)
+ = mode_for_size_tree (TYPE_SIZE (type), MODE_INT, 1);
if (TYPE_MODE (type) != BLKmode
&& STRICT_ALIGNMENT && TYPE_ALIGN (type) < BIGGEST_ALIGNMENT