aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2007-05-28 19:43:10 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2007-05-28 12:43:10 -0700
commit3613c7abfa4392fd47d5078eb2261ad763772d2e (patch)
tree115b6795f44871b452f47fbbb8f7221a4041f1d5 /gcc/fold-const.c
parent3366c30b7fc1404833d54aaeb54de57ca7a16e16 (diff)
downloadgcc-3613c7abfa4392fd47d5078eb2261ad763772d2e.zip
gcc-3613c7abfa4392fd47d5078eb2261ad763772d2e.tar.gz
gcc-3613c7abfa4392fd47d5078eb2261ad763772d2e.tar.bz2
re PR tree-optimization/32100 (vrp bitfield miscompilation)
2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32100 * fold-const.c (tree_expr_nonnegative_warnv_p): Don't return true when truth_value_p is true and the type is of signed:1. 2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32100 * gcc.c-torture/execute/vrp-7.c: New test. From-SVN: r125139
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 16dfd3b..01ce961 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -13485,9 +13485,14 @@ tree_expr_nonnegative_warnv_p (tree t, bool *strict_overflow_p)
/* ... fall through ... */
default:
- if (truth_value_p (TREE_CODE (t)))
- /* Truth values evaluate to 0 or 1, which is nonnegative. */
- return true;
+ {
+ tree type = TREE_TYPE (t);
+ if ((TYPE_PRECISION (type) != 1 || TYPE_UNSIGNED (type))
+ && truth_value_p (TREE_CODE (t)))
+ /* Truth values evaluate to 0 or 1, which is nonnegative unless we
+ have a signed:1 type (where the value is -1 and 0). */
+ return true;
+ }
}
/* We don't know sign of `t', so be conservative and return false. */