aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRoger Sayle <sayle@gcc.gnu.org>2004-02-09 14:00:36 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2004-02-09 14:00:36 +0000
commitb83c4036106e89a5c12f75519bdfeb125d27cbb6 (patch)
tree6f4b5b4522317bca19876d7fc59f62216ff8267d /gcc/fold-const.c
parent12001e0ff90b5a446e192e5c9672b98bb89ac866 (diff)
downloadgcc-b83c4036106e89a5c12f75519bdfeb125d27cbb6.zip
gcc-b83c4036106e89a5c12f75519bdfeb125d27cbb6.tar.gz
gcc-b83c4036106e89a5c12f75519bdfeb125d27cbb6.tar.bz2
fold-const.c (fold): Use the original type conversion tree code rather than call fold_convert...
* fold-const.c (fold) <NOP_EXPR>: Use the original type conversion tree code rather than call fold_convert, which doesn't specify a default floating point to integer conversion. * gcc.c-torture/compile/20040209-1.c: New test case. From-SVN: r77535
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index b51a510..3f68051 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5641,8 +5641,8 @@ fold (tree expr)
if (TYPE_MAIN_VARIANT (inside_type) == TYPE_MAIN_VARIANT (final_type)
&& ((inter_int && final_int) || (inter_float && final_float))
&& inter_prec >= final_prec)
- return fold_convert (final_type,
- TREE_OPERAND (TREE_OPERAND (t, 0), 0));
+ return fold (build1 (code, final_type,
+ TREE_OPERAND (TREE_OPERAND (t, 0), 0)));
/* Likewise, if the intermediate and final types are either both
float or both integer, we don't need the middle conversion if
@@ -5657,16 +5657,16 @@ fold (tree expr)
&& ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type))
&& TYPE_MODE (final_type) == TYPE_MODE (inter_type))
&& ! final_ptr)
- return fold_convert (final_type,
- TREE_OPERAND (TREE_OPERAND (t, 0), 0));
+ return fold (build1 (code, final_type,
+ TREE_OPERAND (TREE_OPERAND (t, 0), 0)));
/* If we have a sign-extension of a zero-extended value, we can
replace that by a single zero-extension. */
if (inside_int && inter_int && final_int
&& inside_prec < inter_prec && inter_prec < final_prec
&& inside_unsignedp && !inter_unsignedp)
- return fold_convert (final_type,
- TREE_OPERAND (TREE_OPERAND (t, 0), 0));
+ return fold (build1 (code, final_type,
+ TREE_OPERAND (TREE_OPERAND (t, 0), 0)));
/* Two conversions in a row are not needed unless:
- some conversion is floating-point (overstrict for now), or
@@ -5690,8 +5690,8 @@ fold (tree expr)
&& ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type))
&& TYPE_MODE (final_type) == TYPE_MODE (inter_type))
&& ! final_ptr)
- return fold_convert (final_type,
- TREE_OPERAND (TREE_OPERAND (t, 0), 0));
+ return fold (build1 (code, final_type,
+ TREE_OPERAND (TREE_OPERAND (t, 0), 0)));
}
if (TREE_CODE (TREE_OPERAND (t, 0)) == MODIFY_EXPR