aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorUros Bizjak <uros@gcc.gnu.org>2010-11-22 17:14:27 +0100
committerUros Bizjak <uros@gcc.gnu.org>2010-11-22 17:14:27 +0100
commit47f647e44f933272c7d0c2a707ff537369b30ca0 (patch)
tree9b6fed6eed75bad4de1e07fba839f3ddeeb0be58 /gcc/fold-const.c
parent3dbcee5bb833512fc8225ae83724ba0891328476 (diff)
downloadgcc-47f647e44f933272c7d0c2a707ff537369b30ca0.zip
gcc-47f647e44f933272c7d0c2a707ff537369b30ca0.tar.gz
gcc-47f647e44f933272c7d0c2a707ff537369b30ca0.tar.bz2
re PR middle-end/43057 ([LTO] fold check: original tree changed by fold)
PR middle-end/43057 * fold-const.c (pedantic_non_lvalue_loc): Unshare x before setting location. From-SVN: r167037
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 9f1e080..7306863 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2097,7 +2097,16 @@ pedantic_non_lvalue_loc (location_t loc, tree x)
{
if (pedantic_lvalues)
return non_lvalue_loc (loc, x);
- protected_set_expr_location (x, loc);
+
+ if (CAN_HAVE_LOCATION_P (x)
+ && EXPR_LOCATION (x) != loc
+ && !(TREE_CODE (x) == SAVE_EXPR
+ || TREE_CODE (x) == TARGET_EXPR
+ || TREE_CODE (x) == BIND_EXPR))
+ {
+ x = copy_node (x);
+ SET_EXPR_LOCATION (x, loc);
+ }
return x;
}