diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2001-11-16 14:02:56 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2001-11-16 09:02:56 -0500 |
commit | c952ff4b08da49521b76581968e7ec99b2da88e7 (patch) | |
tree | 645b82a170424a338299393c111daedf76451151 /gcc/expr.c | |
parent | f4dc10d1cb94e94ee72bf6cdd1239ac2c89c99f8 (diff) | |
download | gcc-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.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -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 |