]> gcc.gnu.org Git - gcc.git/commitdiff
stor-layout.c (compute_record_mode): Don't force BLKmode if field is zero-length...
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Fri, 10 Oct 2003 19:21:12 +0000 (19:21 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Fri, 10 Oct 2003 19:21:12 +0000 (15:21 -0400)
* stor-layout.c (compute_record_mode): Don't force BLKmode if
field is zero-length BLKmode.
* expr.c (expand_expr, case COMPONENT_REF): Handle case of BLKmode
zero-size references.

From-SVN: r72311

gcc/ChangeLog
gcc/expr.c
gcc/stor-layout.c

index 4f351d31a45abba851e1eed504e304d488d000df..8f659510653ac04098184ecf3f3a2ac0e2be5dbf 100644 (file)
@@ -1,5 +1,10 @@
 2003-10-10  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
+       * stor-layout.c (compute_record_mode): Don't force BLKmode if
+       field is zero-length BLKmode.
+       * expr.c (expand_expr, case COMPONENT_REF): Handle case of BLKmode
+       zero-size references.
+
        * combine.c (distribute_links): Properly test for REG being set.
 
        * config/alpha/alpha.c (alpha_expand_block_mode): Don't use
index 9c912d0b60a02ed09011e1ef086b1d098b7381e9..54bff3f5be2c59b368223f1c9a4e1c11168b2c6a 100644 (file)
@@ -7223,6 +7223,12 @@ expand_expr (tree exp, rtx target, enum machine_mode tmode,
 
            if (ext_mode == BLKmode)
              {
+               if (target == 0)
+                 target = assign_temp (type, 0, 1, 1);
+
+               if (bitsize == 0)
+                 return target;
+
                /* In this case, BITPOS must start at a byte boundary and
                   TARGET, if specified, must be a MEM.  */
                if (GET_CODE (op0) != MEM
@@ -7230,11 +7236,9 @@ expand_expr (tree exp, rtx target, enum machine_mode tmode,
                    || bitpos % BITS_PER_UNIT != 0)
                  abort ();
 
-               op0 = adjust_address (op0, VOIDmode, bitpos / BITS_PER_UNIT);
-               if (target == 0)
-                 target = assign_temp (type, 0, 1, 1);
-
-               emit_block_move (target, op0,
+               emit_block_move (target,
+                                adjust_address (op0, VOIDmode,
+                                                bitpos / BITS_PER_UNIT),
                                 GEN_INT ((bitsize + BITS_PER_UNIT - 1)
                                          / BITS_PER_UNIT),
                                 (modifier == EXPAND_STACK_PARM
index 728b70bf9c6bfdd1d11f4148e0fe836d1ee2553a..a7ffd4cb6d838f921a89070de720c0a18b6813a7 100644 (file)
@@ -1318,7 +1318,9 @@ compute_record_mode (tree type)
 
       if (TREE_CODE (TREE_TYPE (field)) == ERROR_MARK
          || (TYPE_MODE (TREE_TYPE (field)) == BLKmode
-             && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field)))
+             && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field))
+             && !(TYPE_SIZE (TREE_TYPE (field)) != 0
+                  && integer_zerop (TYPE_SIZE (TREE_TYPE (field)))))
          || ! host_integerp (bit_position (field), 1)
          || DECL_SIZE (field) == 0
          || ! host_integerp (DECL_SIZE (field), 1))
This page took 0.084649 seconds and 5 git commands to generate.