aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2012-10-15 10:48:17 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2012-10-15 10:48:17 +0000
commit9506aecb3b05c1a9f1f04760fc5320acbfc283b1 (patch)
treecf71a31c094d976a5684e5387e5079bfd0807bb6 /gcc/expr.c
parent0127aae46a182abeadf7419088ad85c9ba5bffc8 (diff)
downloadgcc-9506aecb3b05c1a9f1f04760fc5320acbfc283b1.zip
gcc-9506aecb3b05c1a9f1f04760fc5320acbfc283b1.tar.gz
gcc-9506aecb3b05c1a9f1f04760fc5320acbfc283b1.tar.bz2
expr.c (expand_expr_real_1): Do not unnecessarily copy the object in the MEM_P case.
* expr.c (expand_expr_real_1) <VIEW_CONVERT_EXPR>: Do not unnecessarily copy the object in the MEM_P case. From-SVN: r192452
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 1adea93..7cf812d 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10270,10 +10270,15 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
{
enum insn_code icode;
- op0 = copy_rtx (op0);
-
if (TYPE_ALIGN_OK (type))
- set_mem_align (op0, MAX (MEM_ALIGN (op0), TYPE_ALIGN (type)));
+ {
+ /* ??? Copying the MEM without substantially changing it might
+ run afoul of the code handling volatile memory references in
+ store_expr, which assumes that TARGET is returned unmodified
+ if it has been used. */
+ op0 = copy_rtx (op0);
+ set_mem_align (op0, MAX (MEM_ALIGN (op0), TYPE_ALIGN (type)));
+ }
else if (mode != BLKmode
&& MEM_ALIGN (op0) < GET_MODE_ALIGNMENT (mode)
/* If the target does have special handling for unaligned