diff options
author | Marek Polacek <polacek@redhat.com> | 2017-05-19 15:30:54 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2017-05-19 15:30:54 +0000 |
commit | 33f8c0a14da482bc7884e5f663615a3d7fd08cff (patch) | |
tree | 0c42b764c20d321089046e2fa134c11df25dbbdd /gcc/fold-const.c | |
parent | ff50231797977a56a0d256db645f1e004c6acf00 (diff) | |
download | gcc-33f8c0a14da482bc7884e5f663615a3d7fd08cff.zip gcc-33f8c0a14da482bc7884e5f663615a3d7fd08cff.tar.gz gcc-33f8c0a14da482bc7884e5f663615a3d7fd08cff.tar.bz2 |
re PR sanitizer/80800 (UBSAN: yet another false positive)
PR sanitizer/80800
* fold-const.c (extract_muldiv_1) <case TRUNC_DIV_EXPR>: Add
TYPE_OVERFLOW_WRAPS checks.
* c-c++-common/ubsan/pr80800.c: New test.
* c-c++-common/Wduplicated-branches-1.c: Adjust an expression.
From-SVN: r248291
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 19aa722..736552c 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6281,11 +6281,13 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type, new operation. Likewise for the RHS from a MULT_EXPR. Otherwise, do something only if the second operand is a constant. */ if (same_p + && TYPE_OVERFLOW_WRAPS (ctype) && (t1 = extract_muldiv (op0, c, code, wide_type, strict_overflow_p)) != 0) return fold_build2 (tcode, ctype, fold_convert (ctype, t1), fold_convert (ctype, op1)); else if (tcode == MULT_EXPR && code == MULT_EXPR + && TYPE_OVERFLOW_WRAPS (ctype) && (t1 = extract_muldiv (op1, c, code, wide_type, strict_overflow_p)) != 0) return fold_build2 (tcode, ctype, fold_convert (ctype, op0), |