aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2014-05-16 16:59:38 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2014-05-16 16:59:38 +0000
commit8b628e86eca0f0719a58070b08fc794483fad6a1 (patch)
tree1b4bb7349e7b1658de1e60c41f802739a387558b /gcc/fold-const.c
parent53caffbe8d6f79b26ae4226db9b306099fbf571b (diff)
downloadgcc-8b628e86eca0f0719a58070b08fc794483fad6a1.zip
gcc-8b628e86eca0f0719a58070b08fc794483fad6a1.tar.gz
gcc-8b628e86eca0f0719a58070b08fc794483fad6a1.tar.bz2
fold-const (fold_unary_loc): New case.
* fold-const (fold_unary_loc) <NON_LVALUE_EXPR>: New case. <CASE_CONVERT>: Pass arg0 instead of op0 to fold_convert_const. From-SVN: r210518
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 8f659db..188b179 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7850,6 +7850,11 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
return fold_convert_loc (loc, type, op0);
return NULL_TREE;
+ case NON_LVALUE_EXPR:
+ if (!maybe_lvalue_p (op0))
+ return fold_convert_loc (loc, type, op0);
+ return NULL_TREE;
+
CASE_CONVERT:
case FLOAT_EXPR:
case FIX_TRUNC_EXPR:
@@ -8113,7 +8118,7 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
}
}
- tem = fold_convert_const (code, type, op0);
+ tem = fold_convert_const (code, type, arg0);
return tem ? tem : NULL_TREE;
case ADDR_SPACE_CONVERT_EXPR: