diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-09-09 19:09:59 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-09-09 19:09:59 +0200 |
commit | 28fd0ba2d17a09ddf5106f1e60c475a93fba3090 (patch) | |
tree | 0a438d585a5e277f8a5489576bb8698c82b76786 /gcc | |
parent | 552d99fe881c262ec96235e9e8f00fc54809f458 (diff) | |
download | gcc-28fd0ba2d17a09ddf5106f1e60c475a93fba3090.zip gcc-28fd0ba2d17a09ddf5106f1e60c475a93fba3090.tar.gz gcc-28fd0ba2d17a09ddf5106f1e60c475a93fba3090.tar.bz2 |
re PR tree-optimization/58364 (likely wrong code bug)
PR tree-optimization/58364
* tree-ssa-reassoc.c (init_range_entry): For BIT_NOT_EXPR on
BOOLEAN_TYPE, only invert in_p and continue with arg0 if
the current range can't be an unconditional true or false.
* gcc.c-torture/execute/pr58364.c: New test.
From-SVN: r202409
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr58364.c | 17 | ||||
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 9 |
4 files changed, 37 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3edd100..dd9a3e0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-09-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/58364 + * tree-ssa-reassoc.c (init_range_entry): For BIT_NOT_EXPR on + BOOLEAN_TYPE, only invert in_p and continue with arg0 if + the current range can't be an unconditional true or false. + 2013-09-09 James Greenhalgh <james.greenhalgh@arm.com> * config/aarch64/arm_neon.h (vrsqrte_f64): Fix parameter type. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 177ed3fd..befd28d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/58364 + * gcc.c-torture/execute/pr58364.c: New test. + 2013-09-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/43452 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58364.c b/gcc/testsuite/gcc.c-torture/execute/pr58364.c new file mode 100644 index 0000000..59ad7b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58364.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/58364 */ + +int a = 1, b, c; + +int +foo (int x) +{ + return x < 0 ? 1 : x; +} + +int +main () +{ + if (foo (a > c == (b = 0))) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 03c6c5d..b4a3b0a 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1801,7 +1801,14 @@ init_range_entry (struct range_entry *r, tree exp, gimple stmt) switch (code) { case BIT_NOT_EXPR: - if (TREE_CODE (TREE_TYPE (exp)) == BOOLEAN_TYPE) + if (TREE_CODE (TREE_TYPE (exp)) == BOOLEAN_TYPE + /* Ensure the range is either +[-,0], +[0,0], + -[-,0], -[0,0] or +[1,-], +[1,1], -[1,-] or + -[1,1]. If it is e.g. +[-,-] or -[-,-] + or similar expression of unconditional true or + false, it should not be negated. */ + && ((high && integer_zerop (high)) + || (low && integer_onep (low)))) { in_p = !in_p; exp = arg0; |