From: Richard Biener Date: Wed, 21 Oct 2015 07:56:54 +0000 (+0000) Subject: re PR tree-optimization/68026 (Regression in GCC-6.0.0's optimizer) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=33b35c280747d60086dc2cc640a3c15239ec3e8d;p=gcc.git re PR tree-optimization/68026 (Regression in GCC-6.0.0's optimizer) 2015-10-21 Richard Biener PR tree-optimization/68026 * tree-ssa-ccp.c (get_value_for_expr): Zero-extend mask for unsigned VARYING values. * gcc.dg/tree-ssa/ssa-ccp-39.c: New testcase. From-SVN: r229117 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2b15977437a..20c272d9edc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-10-21 Richard Biener + + PR tree-optimization/68026 + * tree-ssa-ccp.c (get_value_for_expr): Zero-extend mask for + unsigned VARYING values. + 2015-10-21 Maxim Ostapenko * asan.c (asan_emit_stack_protection): Don't pass local stack to diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index df804352bd3..1809ddfcce3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-10-21 Richard Biener + + PR tree-optimization/68026 + * gcc.dg/tree-ssa/ssa-ccp-39.c: New testcase. + 2015-10-21 Maxim Ostapenko * c-c++-common/ubsan/float-cast-overflow-10.c: Adjust test. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-39.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-39.c new file mode 100644 index 00000000000..21af5593f50 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-39.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-options "-O -fdump-tree-ccp1" } */ + +int main (void) +{ + volatile int x1 = 1; + volatile int x2 = 1; + int x3 = 2; + int t = 1; + + t = 3<=(x2|1|x3|x1-1U); + + if (t == 1) {} + else { __builtin_abort(); } + + return 0; +} + +/* { dg-final { scan-tree-dump-not "abort" "ccp1" } } */ diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index ed5fe1e3cea..2c69178a0ae 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -629,6 +629,11 @@ get_value_for_expr (tree expr, bool for_bits_p) val.mask = -1; val.value = NULL_TREE; } + + if (val.lattice_val == VARYING + && TYPE_UNSIGNED (TREE_TYPE (expr))) + val.mask = wi::zext (val.mask, TYPE_PRECISION (TREE_TYPE (expr))); + return val; }