+Fri Nov 16 09:06:25 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * 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.
+
2001-11-16 Graham Stott <grahams@redhat.com>
* optabs.c (prepare_cmp_insn): Correct lossage in last change fix
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
/* Reset the alignment in case we have made it tighter, so we can benefit
from it in get_pointer_alignment. */
DECL_ALIGN (decl) = align;
+ set_mem_align (decl_rtl, align);
/* Handle uninitialized definitions. */