aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2001-11-16 14:02:56 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2001-11-16 09:02:56 -0500
commitc952ff4b08da49521b76581968e7ec99b2da88e7 (patch)
tree645b82a170424a338299393c111daedf76451151 /gcc/expr.c
parentf4dc10d1cb94e94ee72bf6cdd1239ac2c89c99f8 (diff)
downloadgcc-c952ff4b08da49521b76581968e7ec99b2da88e7.zip
gcc-c952ff4b08da49521b76581968e7ec99b2da88e7.tar.gz
gcc-c952ff4b08da49521b76581968e7ec99b2da88e7.tar.bz2
expr.c (expand_expr, [...]): Refine test for when to copy misaligned data.
* expr.c (expand_expr, case ADDR_EXPR): Refine test for when to copy misaligned data. * varasm.c (assemble_variable): Set alignment into MEM when changed. From-SVN: r47089
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index afc43cc..92397ee 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -8649,11 +8649,19 @@ expand_expr (exp, target, tmode, modifier)
return op0;
}
- /* If OP0 is not aligned as least as much as the type requires,
- we need to make a temporary, copy OP0 to it, and take the
- address of the temporary. */
- if (GET_MODE (op0) == BLKmode
- && expr_align (TREE_OPERAND (exp, 0)) > MEM_ALIGN (op0))
+ /* If OP0 is not aligned as least as much as the type requires, we
+ need to make a temporary, copy OP0 to it, and take the address of
+ the temporary. We want to use the alignment of the type, not of
+ the operand. Note that this is incorrect for FUNCTION_TYPE, but
+ the test for BLKmode means that can't happen. The test for
+ BLKmode is because we never make mis-aligned MEMs with
+ non-BLKmode.
+
+ We don't need to do this at all if the machine doesn't have
+ strict alignment. */
+ if (STRICT_ALIGNMENT && GET_MODE (op0) == BLKmode
+ && (TYPE_ALIGN (TREE_TYPE (TREE_OPERAND (exp, 0)))
+ > MEM_ALIGN (op0)))
{
tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
rtx new