]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stor-layout.c (layout_type, [...]): Give one-element array the same mode as its compo...
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Tue, 2 Apr 2002 12:00:30 +0000 (12:00 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Tue, 2 Apr 2002 12:00:30 +0000 (07:00 -0500)
* stor-layout.c (layout_type, case ARRAY_TYPE): Give one-element array
the same mode as its component.

From-SVN: r51745

gcc/ChangeLog
gcc/stor-layout.c

index 8fa21c4772449f1539a838e958340f03b32641dd..3cb11a0e53512cda4bebc8890299182ee29b7632 100644 (file)
@@ -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
index 829500007beb29ebf05af25ac878633dd80e962f..baf26dddba1ac6ffae37f0ff14621490f1499a09 100644 (file)
@@ -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