From cd5ffed9f5bd9f92a5972c6544bc640ac1991940 Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 7 Dec 2008 20:33:07 +0000 Subject: [PATCH] 2008-12-07 Richard Guenther 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 --- gcc/ChangeLog | 6 ++++++ gcc/tree-vrp.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 85cd145d8e4..19d56b0bfc7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-12-07 Richard Guenther + + PR tree-optimization/38405 + * tree-vrp.c (simplify_truth_ops_using_ranges): Make sure to + not sign-extend truth values. + 2008-12-07 Eric Botcazou * tree-sra.c (scalarize_use): Create another temporary with the proper 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: -- 2.11.4.GIT