diff options
author | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-22 16:14:27 +0000 |
---|---|---|
committer | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-22 16:14:27 +0000 |
commit | 35f20bce181aa74133eca0229542433923aca6e4 (patch) | |
tree | 9b6fed6eed75bad4de1e07fba839f3ddeeb0be58 /gcc/fold-const.c | |
parent | 3bfb8d8ca7584f7d1ea1223bb625b9097cefc5f4 (diff) | |
download | gcc-35f20bce181aa74133eca0229542433923aca6e4.tar.gz |
PR middle-end/43057
* fold-const.c (pedantic_non_lvalue_loc): Unshare x before
setting location.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167037 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 9f1e0809a3c..7306863ff97 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; } |