summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-propagate.c
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2005-07-08 19:26:16 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2005-07-08 12:26:16 -0700
commit52b27f98cf3b03e9b6b876539b00aaf8ce279a44 (patch)
treed8ba1b61150f89c23c97e3b4449de2ef40b5749a /gcc/tree-ssa-propagate.c
parent3ffa3729c00a1d9ddd52a89813ccd31b28b552f5 (diff)
downloadgcc-52b27f98cf3b03e9b6b876539b00aaf8ce279a44.tar.gz
re PR tree-optimization/22329 (VRP produces mis-matched (non compatible) types in MODIFY_EXPR)
2005-07-08 Andrew Pinski <pinskia@physics.uc.edu> PR tree-opt/22329 * gcc.dg/pr22329.c: New test. 2005-07-08 Andrew Pinski <pinskia@physics.uc.edu> PR tree-opt/22329 * tree-ssa-propagate.c (fold_predicate_in): Convert the value to the correct type if we have a MODIFY_EXPR. From-SVN: r101789
Diffstat (limited to 'gcc/tree-ssa-propagate.c')
-rw-r--r--gcc/tree-ssa-propagate.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index b9b308e6078..07b13e3fa5f 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -1018,11 +1018,15 @@ static bool
fold_predicate_in (tree stmt)
{
tree *pred_p = NULL;
+ bool modify_expr_p = false;
tree val;
if (TREE_CODE (stmt) == MODIFY_EXPR
&& COMPARISON_CLASS_P (TREE_OPERAND (stmt, 1)))
- pred_p = &TREE_OPERAND (stmt, 1);
+ {
+ modify_expr_p = true;
+ pred_p = &TREE_OPERAND (stmt, 1);
+ }
else if (TREE_CODE (stmt) == COND_EXPR)
pred_p = &COND_EXPR_COND (stmt);
else
@@ -1031,6 +1035,9 @@ fold_predicate_in (tree stmt)
val = vrp_evaluate_conditional (*pred_p, true);
if (val)
{
+ if (modify_expr_p)
+ val = fold_convert (TREE_TYPE (*pred_p), val);
+
if (dump_file)
{
fprintf (dump_file, "Folding predicate ");