From: Richard Biener Date: Tue, 25 Jul 2017 07:04:07 +0000 (+0000) Subject: re PR sanitizer/81505 (ICE in tree-ssa-loop-manip.c:95 with -fsanitize=signed-integer... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3d99332b9a3fb72aca3c724949cb5373858245cf;p=gcc.git re PR sanitizer/81505 (ICE in tree-ssa-loop-manip.c:95 with -fsanitize=signed-integer-overflow) 2017-07-25 Richard Biener PR middle-end/81505 * fold-const.c (fold_negate_const): TREE_OVERFLOW should be sticky. * gcc.dg/ubsan/pr81505.c: New testcase. From-SVN: r250494 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7b6e895dde..54d6c5438ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-07-25 Richard Biener + + PR middle-end/81505 + * fold-const.c (fold_negate_const): TREE_OVERFLOW should be + sticky. + 2017-07-24 Michael Meissner * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Delete diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c061f3e2f89..ecba3ffada4 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13702,8 +13702,8 @@ fold_negate_const (tree arg0, tree type) bool overflow; wide_int val = wi::neg (arg0, &overflow); t = force_fit_type (type, val, 1, - (overflow | TREE_OVERFLOW (arg0)) - && !TYPE_UNSIGNED (type)); + (overflow && ! TYPE_UNSIGNED (type)) + || TREE_OVERFLOW (arg0)); break; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 07d7897821e..82119f104dd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-25 Richard Biener + + PR middle-end/81505 + * gcc.dg/ubsan/pr81505.c: New testcase. + 2017-07-24 Daniel Santos PR testsuite/80759 diff --git a/gcc/testsuite/gcc.dg/ubsan/pr81505.c b/gcc/testsuite/gcc.dg/ubsan/pr81505.c new file mode 100644 index 00000000000..1cebef56172 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pr81505.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fsanitize=signed-integer-overflow" } */ + +int a, b, c, h; + +int i[5][5]; + +void +fn1 () +{ + int l = 0; + + for (a = 0; a <= 3; a++) + for (b = 1; b >= 0; b -= 1) + l |= i[0][b]; + c = l; +}