From 6c1dfcdb7acdf421ab0b249cb3c703b291e843c8 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 22 Nov 2010 19:02:58 +0100 Subject: [PATCH] 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: r167042 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 86af167e2506..04141207db21 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-11-22 Uros Bizjak + + PR middle-end/43057 + * fold-const.c (pedantic_non_lvalue_loc): Unshare x before + setting location. + 2010-11-21 Richard Henderson PR rtl-optimization/46571 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6aba8a2dd25a..0bd9c34fb412 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2875,7 +2875,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; } -- 2.47.2