summaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-07 20:33:07 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-07 20:33:07 +0000
commitcd5ffed9f5bd9f92a5972c6544bc640ac1991940 (patch)
treedc230a771ff4feb71ae8d166dd3ed4608d98ee72 /gcc/tree-vrp.c
parent833b5dc68608872f540731e9bfa2dfe5c29265e0 (diff)
downloadgcc-cd5ffed9f5bd9f92a5972c6544bc640ac1991940.tar.gz
2008-12-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38405 * tree-vrp.c (simplify_truth_ops_using_ranges): Make sure to not sign-extend truth values. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142539 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 1289c49ef1d..a69b216b796 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -6512,6 +6512,12 @@ simplify_truth_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
!useless_type_conversion_p (TREE_TYPE (gimple_assign_lhs (stmt)),
TREE_TYPE (op0));
+ /* Make sure to not sign-extend -1 as a boolean value. */
+ if (need_conversion
+ && !TYPE_UNSIGNED (TREE_TYPE (op0))
+ && TYPE_PRECISION (TREE_TYPE (op0)) == 1)
+ return false;
+
switch (rhs_code)
{
case TRUTH_AND_EXPR: