aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-09-25 09:50:29 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-09-25 09:50:29 +0000
commit15dbc1a6df73343e769a8e310c1ed89829b61613 (patch)
treebce2a9d14d5ecf32f4056017dc04cade4e2301c4 /gcc/c-family
parent89e5941d8c79863857a60a41ce58d6a984df1bdf (diff)
downloadgcc-15dbc1a6df73343e769a8e310c1ed89829b61613.zip
gcc-15dbc1a6df73343e769a8e310c1ed89829b61613.tar.gz
gcc-15dbc1a6df73343e769a8e310c1ed89829b61613.tar.bz2
re PR sanitizer/64906 (-fsanitize=integer-divide-by-zero creates false -Wmaybe-uninitialized warning)
PR sanitizer/64906 * c-ubsan.c (ubsan_instrument_division): Also pre-evaluate OP1. * c-c++-common/ubsan/pr64906.c: New test. From-SVN: r228112
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-ubsan.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index e409150..b9feff6 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-25 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/64906
+ * c-ubsan.c (ubsan_instrument_division): Also pre-evaluate OP1.
+
2015-09-24 Patrick Palka <ppalka@gcc.gnu.org>
* c-indentation.c (should_warn_for_misleading_indentation):
diff --git a/gcc/c-family/c-ubsan.c b/gcc/c-family/c-ubsan.c
index e0cce84..d2bc264 100644
--- a/gcc/c-family/c-ubsan.c
+++ b/gcc/c-family/c-ubsan.c
@@ -104,6 +104,7 @@ ubsan_instrument_division (location_t loc, tree op0, tree op1)
}
}
t = fold_build2 (COMPOUND_EXPR, TREE_TYPE (t), unshare_expr (op0), t);
+ t = fold_build2 (COMPOUND_EXPR, TREE_TYPE (t), unshare_expr (op1), t);
if (flag_sanitize_undefined_trap_on_error)
tt = build_call_expr_loc (loc, builtin_decl_explicit (BUILT_IN_TRAP), 0);
else