aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-06-07 17:17:08 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-06-07 17:17:08 -0400
commit25216284b046e081ea867c3c40c1c2d1697f80a2 (patch)
treead5ef37cad882dcc8514ab1619a163b8159f0379 /gcc/fold-const.c
parentd36c3fe262cb205ef83d863685fade5c12c4f7ef (diff)
downloadgcc-25216284b046e081ea867c3c40c1c2d1697f80a2.zip
gcc-25216284b046e081ea867c3c40c1c2d1697f80a2.tar.gz
gcc-25216284b046e081ea867c3c40c1c2d1697f80a2.tar.bz2
(fold): When folding `<' type nodes, make true_value and false_value
have correct types. From-SVN: r9899
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e95a2c8..d310c8e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2615,7 +2615,7 @@ range_test (jcode, type, lo_code, hi_code, var, lo_cst, hi_cst)
}
/* Subroutine for fold_truthop: C is an INTEGER_CST interpreted as a P
- bit value. Arrange things so the extra bits will be set to zero if and]
+ bit value. Arrange things so the extra bits will be set to zero if and
only if C is signed-extended to its full width. */
static tree
@@ -3270,9 +3270,10 @@ fold (expr)
}
else
{
+ tree testtype = TREE_TYPE (arg1);
test = arg1;
- true_value = integer_one_node;
- false_value = integer_zero_node;
+ true_value = convert (testtype, integer_one_node);
+ false_value = convert (testtype, integer_zero_node);
}
/* If ARG0 is complex we want to make sure we only evaluate
@@ -3325,9 +3326,10 @@ fold (expr)
}
else
{
+ tree testtype = TREE_TYPE (arg0);
test = arg0;
- true_value = integer_one_node;
- false_value = integer_zero_node;
+ true_value = convert (testtype, integer_one_node);
+ false_value = convert (testtype, integer_zero_node);
}
if (TREE_CODE (arg1) != SAVE_EXPR