aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-02-02 13:04:50 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2000-02-02 08:04:50 -0500
commitc297a34efeea705c788f54ea253d7704172ce001 (patch)
tree79e02b748d5568867134eb7c25089de0088da725 /gcc/expr.c
parenta7c197f8eb18f384af109ee85bd34ad79dbeebe0 (diff)
downloadgcc-c297a34efeea705c788f54ea253d7704172ce001.zip
gcc-c297a34efeea705c788f54ea253d7704172ce001.tar.gz
gcc-c297a34efeea705c788f54ea253d7704172ce001.tar.bz2
expr.c (store_field): Ensure ALIGN is no stricter than the alignment of EXP.
* expr.c (store_field): Ensure ALIGN is no stricter than the alignment of EXP. From-SVN: r31759
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 41b0188..087aaa3 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4817,6 +4817,13 @@ store_field (target, bitsize, bitpos, mode, exp, value_mode,
plus_constant (XEXP (target, 0),
bitpos / BITS_PER_UNIT));
+ /* Make sure that ALIGN is no stricter than the alignment of
+ EXP. */
+ if (TREE_CODE (exp) == VAR_DECL)
+ align = MIN (DECL_ALIGN (exp) / BITS_PER_UNIT, align);
+ else
+ align = MIN (TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT, align);
+
/* Find an alignment that is consistent with the bit position. */
while ((bitpos % (align * BITS_PER_UNIT)) != 0)
align >>= 1;