From: Uros Bizjak Date: Mon, 22 Nov 2010 18:02:58 +0000 (+0100) Subject: re PR middle-end/43057 ([LTO] fold check: original tree changed by fold) X-Git-Tag: releases/gcc-4.5.2~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c1dfcdb7acdf421ab0b249cb3c703b291e843c8;p=thirdparty%2Fgcc.git 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 --- 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; }