(with { tree res = int_const_binop (rop, @2, @1); }
(if (TREE_OVERFLOW (res))
{
- fold_overflow_warning (("assuming signed overflow does not occur "
- "when simplifying conditional to constant"),
- WARN_STRICT_OVERFLOW_CONDITIONAL);
bool less = cmp == LE_EXPR || cmp == LT_EXPR;
/* wi::ges_p (@2, 0) should be sufficient for a signed type. */
bool ovf_high = wi::lt_p (wi::to_wide (@1), 0,
constant_boolean_node (less == ovf_high, type);
}
(if (single_use (@3))
- (with
- {
- fold_overflow_warning (("assuming signed overflow does not occur "
- "when changing X +- C1 cmp C2 to "
- "X cmp C2 -+ C1"),
- WARN_STRICT_OVERFLOW_COMPARISON);
- }
- (cmp @0 { res; })))))
+ (cmp @0 { res; }))))
/* For wrapping types, simplify the following cases of X +- C1 CMP C2:
(a) If CMP is <= and C2 -+ C1 == +INF (1), simplify to X >= -INF -+ C1
+++ /dev/null
-/* { dg-do compile } */
-/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=3" } */
-
-/* Source: Ian Lance Taylor. Based on strict-overflow-1.c. */
-
-/* We can only simplify the conditional when using strict overflow
- semantics. */
-
-int
-foo (int i)
-{
- return i - 5 < 10; /* { dg-warning "assuming signed overflow does not occur" "correct warning" } */
-}
|| flag_wrapv))
/* True if overflow is undefined for the given integral or pointer type.
- We may optimize on the assumption that values in the type never overflow.
-
- IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED
- must issue a warning based on warn_strict_overflow. In some cases
- it will be appropriate to issue the warning immediately, and in
- other cases it will be appropriate to simply set a flag and let the
- caller decide whether a warning is appropriate or not. */
+ We may optimize on the assumption that values in the type never overflow. */
#define TYPE_OVERFLOW_UNDEFINED(TYPE) \
(POINTER_TYPE_P (TYPE) \
? !flag_wrapv_pointer \