diff options
author | Marek Polacek <mpolacek@gcc.gnu.org> | 2013-12-04 22:47:11 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2013-12-04 22:47:11 +0000 |
commit | 31e071aeb827f49ce2e891620852198e99d44a0c (patch) | |
tree | 20fca81276f1e6d6224300c11a4e10fa89519d41 /gcc/c-family | |
parent | 59b6687cceaf95d8c49afee88248cf4fb0a33105 (diff) | |
download | gcc-31e071aeb827f49ce2e891620852198e99d44a0c.zip gcc-31e071aeb827f49ce2e891620852198e99d44a0c.tar.gz gcc-31e071aeb827f49ce2e891620852198e99d44a0c.tar.bz2 |
Implement -fsanitize=signed-integer-overflow.
From-SVN: r205684
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-gimplify.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 616a742..35c0003 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2013-12-04 Jakub Jelinek <jakub@redhat.com> + Marek Polacek <polacek@redhat.com> + + * c-gimplify.c (c_gimplify_expr): If doing the integer-overflow + sanitization, call unsigned_type_for only when !TYPE_OVERFLOW_WRAPS. + 2013-11-29 H.J. Lu <hongjiu.lu@intel.com> PR c/59309 diff --git a/gcc/c-family/c-gimplify.c b/gcc/c-family/c-gimplify.c index d047c65..9f79ccb 100644 --- a/gcc/c-family/c-gimplify.c +++ b/gcc/c-family/c-gimplify.c @@ -199,7 +199,9 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED, tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 0)); if (INTEGRAL_TYPE_P (type) && c_promoting_integer_type_p (type)) { - if (TYPE_OVERFLOW_UNDEFINED (type)) + if (TYPE_OVERFLOW_UNDEFINED (type) + || ((flag_sanitize & SANITIZE_SI_OVERFLOW) + && !TYPE_OVERFLOW_WRAPS (type))) type = unsigned_type_for (type); return gimplify_self_mod_expr (expr_p, pre_p, post_p, 1, type); } |