diff options
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/torture/pr61184.c | 18 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 19 |
4 files changed, 40 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 57dbd0f..c69a30c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2014-05-19 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61184 + * tree-vrp.c (is_negative_overflow_infinity): Use + TREE_OVERFLOW_P and do that check first. + (is_positive_overflow_infinity): Likewise. + (is_overflow_infinity): Likewise. + (vrp_operand_equal_p): Properly treat operands with + differing overflow as not equal. + 2014-05-19 Bernd Schmidt <bernds@codesourcery.com> * simplify-rtx.c (simplify_unary_operation_1): Use CONST_INT_P in diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 846ad6d..d731eb9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-05-19 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61184 + * c-c++-common/torture/pr61184.c: New testcase. + 2014-05-19 Christian Bruel <christian.bruel@st.com> PR target/61195 diff --git a/gcc/testsuite/c-c++-common/torture/pr61184.c b/gcc/testsuite/c-c++-common/torture/pr61184.c new file mode 100644 index 0000000..83117b9 --- /dev/null +++ b/gcc/testsuite/c-c++-common/torture/pr61184.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fno-strict-overflow" } */ + +short a; + +void +foo (void) +{ + for (a = 0; a >= 0; a++) + ; +} + +int +main () +{ + foo (); + return 0; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 633c329..7f0489f 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -293,9 +293,8 @@ positive_overflow_infinity (tree type) static inline bool is_negative_overflow_infinity (const_tree val) { - return (needs_overflow_infinity (TREE_TYPE (val)) - && CONSTANT_CLASS_P (val) - && TREE_OVERFLOW (val) + return (TREE_OVERFLOW_P (val) + && needs_overflow_infinity (TREE_TYPE (val)) && vrp_val_is_min (val)); } @@ -304,9 +303,8 @@ is_negative_overflow_infinity (const_tree val) static inline bool is_positive_overflow_infinity (const_tree val) { - return (needs_overflow_infinity (TREE_TYPE (val)) - && CONSTANT_CLASS_P (val) - && TREE_OVERFLOW (val) + return (TREE_OVERFLOW_P (val) + && needs_overflow_infinity (TREE_TYPE (val)) && vrp_val_is_max (val)); } @@ -315,9 +313,8 @@ is_positive_overflow_infinity (const_tree val) static inline bool is_overflow_infinity (const_tree val) { - return (needs_overflow_infinity (TREE_TYPE (val)) - && CONSTANT_CLASS_P (val) - && TREE_OVERFLOW (val) + return (TREE_OVERFLOW_P (val) + && needs_overflow_infinity (TREE_TYPE (val)) && (vrp_val_is_min (val) || vrp_val_is_max (val))); } @@ -791,9 +788,7 @@ vrp_operand_equal_p (const_tree val1, const_tree val2) return true; if (!val1 || !val2 || !operand_equal_p (val1, val2, 0)) return false; - if (is_overflow_infinity (val1)) - return is_overflow_infinity (val2); - return true; + return is_overflow_infinity (val1) == is_overflow_infinity (val2); } /* Return true, if the bitmaps B1 and B2 are equal. */ |