aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2003-10-10 19:21:12 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2003-10-10 15:21:12 -0400
commit7a06d606a6a5d81acae07c94490217c55278476b (patch)
tree7722b6ab3f8762ae29f0ecc9ce017162d94cdd55 /gcc
parent892c9f1f53581abe563e6e0183fbc05936d10e95 (diff)
downloadgcc-7a06d606a6a5d81acae07c94490217c55278476b.zip
gcc-7a06d606a6a5d81acae07c94490217c55278476b.tar.gz
gcc-7a06d606a6a5d81acae07c94490217c55278476b.tar.bz2
stor-layout.c (compute_record_mode): Don't force BLKmode if field is zero-length BLKmode.
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/expr.c14
-rw-r--r--gcc/stor-layout.c4
3 files changed, 17 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4f351d3..8f65951 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/expr.c b/gcc/expr.c
index 9c912d0..54bff3f 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 728b70b..a7ffd4c 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -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))