mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 03:40:26 +08:00
tree.h (TYPE_OVERFLOW_SANITIZED): Define.
* tree.h (TYPE_OVERFLOW_SANITIZED): Define. * fold-const.c (fold_binary_loc): Use it. * match.pd: Likewise. From-SVN: r217470
This commit is contained in:
parent
882de21478
commit
6a4f06787f
@ -1,3 +1,9 @@
|
||||
2014-11-13 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
* tree.h (TYPE_OVERFLOW_SANITIZED): Define.
|
||||
* fold-const.c (fold_binary_loc): Use it.
|
||||
* match.pd: Likewise.
|
||||
|
||||
2014-11-14 Kirill Yukhin <kirill.yukhin@intel.com>
|
||||
|
||||
* gcc/lra-lives.c (struct bb_data): Rename to ...
|
||||
|
@ -10516,9 +10516,7 @@ fold_binary_loc (location_t loc,
|
||||
|
||||
/* A - B -> A + (-B) if B is easily negatable. */
|
||||
if (negate_expr_p (arg1)
|
||||
&& (!INTEGRAL_TYPE_P (type)
|
||||
|| TYPE_OVERFLOW_WRAPS (type)
|
||||
|| (flag_sanitize & SANITIZE_SI_OVERFLOW) == 0)
|
||||
&& !TYPE_OVERFLOW_SANITIZED (type)
|
||||
&& ((FLOAT_TYPE_P (type)
|
||||
/* Avoid this transformation if B is a positive REAL_CST. */
|
||||
&& (TREE_CODE (arg1) != REAL_CST
|
||||
|
12
gcc/match.pd
12
gcc/match.pd
@ -285,26 +285,20 @@ along with GCC; see the file COPYING3. If not see
|
||||
/* Apply STRIP_NOPS on @0 and the negate. */
|
||||
(if (tree_nop_conversion_p (type, TREE_TYPE (@0))
|
||||
&& tree_nop_conversion_p (type, TREE_TYPE (@1))
|
||||
&& (!INTEGRAL_TYPE_P (type)
|
||||
|| TYPE_OVERFLOW_WRAPS (type)
|
||||
|| (flag_sanitize & SANITIZE_SI_OVERFLOW) == 0))
|
||||
&& !TYPE_OVERFLOW_SANITIZED (type))
|
||||
(minus (convert @0) (convert @1))))
|
||||
/* A - (-B) -> A + B */
|
||||
(simplify
|
||||
(minus (convert1? @0) (convert2? (negate @1)))
|
||||
(if (tree_nop_conversion_p (type, TREE_TYPE (@0))
|
||||
&& tree_nop_conversion_p (type, TREE_TYPE (@1))
|
||||
&& (!INTEGRAL_TYPE_P (type)
|
||||
|| TYPE_OVERFLOW_WRAPS (type)
|
||||
|| (flag_sanitize & SANITIZE_SI_OVERFLOW) == 0))
|
||||
&& !TYPE_OVERFLOW_SANITIZED (type))
|
||||
(plus (convert @0) (convert @1))))
|
||||
/* -(-A) -> A */
|
||||
(simplify
|
||||
(negate (convert? (negate @1)))
|
||||
(if (tree_nop_conversion_p (type, TREE_TYPE (@1))
|
||||
&& (!INTEGRAL_TYPE_P (type)
|
||||
|| TYPE_OVERFLOW_WRAPS (type)
|
||||
|| (flag_sanitize & SANITIZE_SI_OVERFLOW) == 0))
|
||||
&& !TYPE_OVERFLOW_SANITIZED (type))
|
||||
(convert @1)))
|
||||
|
||||
/* We can't reassociate floating-point or fixed-point plus or minus
|
||||
|
@ -789,6 +789,12 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
|
||||
#define TYPE_OVERFLOW_TRAPS(TYPE) \
|
||||
(!TYPE_UNSIGNED (TYPE) && flag_trapv)
|
||||
|
||||
/* True if an overflow is to be preserved for sanitization. */
|
||||
#define TYPE_OVERFLOW_SANITIZED(TYPE) \
|
||||
(INTEGRAL_TYPE_P (TYPE) \
|
||||
&& !TYPE_OVERFLOW_WRAPS (TYPE) \
|
||||
&& (flag_sanitize & SANITIZE_SI_OVERFLOW))
|
||||
|
||||
/* True if pointer types have undefined overflow. */
|
||||
#define POINTER_TYPE_OVERFLOW_UNDEFINED (flag_strict_overflow)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user