From 8b628e86eca0f0719a58070b08fc794483fad6a1 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 16 May 2014 16:59:38 +0000 Subject: [PATCH] fold-const (fold_unary_loc): New case. * fold-const (fold_unary_loc) : New case. : Pass arg0 instead of op0 to fold_convert_const. From-SVN: r210518 --- gcc/ChangeLog | 5 +++++ gcc/fold-const.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f2d0508336d2..e8960026d5d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-05-16 Eric Botcazou + + * fold-const (fold_unary_loc) : New case. + : Pass arg0 instead of op0 to fold_convert_const. + 2014-05-16 Richard Biener PR tree-optimization/61194 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 8f659db76a21..188b179bb787 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: