diff options
author | Richard Biener <rguenther@suse.de> | 2017-07-25 07:04:07 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-07-25 07:04:07 +0000 |
commit | 3d99332b9a3fb72aca3c724949cb5373858245cf (patch) | |
tree | 6ae53eef543af749b8dd916ddea68a34c9d5b6ed /gcc | |
parent | 7ad5808da9f37f615e0d7ee585b89d1ba1a02264 (diff) | |
download | gcc-3d99332b9a3fb72aca3c724949cb5373858245cf.zip gcc-3d99332b9a3fb72aca3c724949cb5373858245cf.tar.gz gcc-3d99332b9a3fb72aca3c724949cb5373858245cf.tar.bz2 |
re PR sanitizer/81505 (ICE in tree-ssa-loop-manip.c:95 with -fsanitize=signed-integer-overflow)
2017-07-25 Richard Biener <rguenther@suse.de>
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ubsan/pr81505.c | 17 |
4 files changed, 30 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7b6e89..54d6c54 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-07-25 Richard Biener <rguenther@suse.de> + + PR middle-end/81505 + * fold-const.c (fold_negate_const): TREE_OVERFLOW should be + sticky. + 2017-07-24 Michael Meissner <meissner@linux.vnet.ibm.com> * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Delete diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c061f3e..ecba3ff 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 07d7897..82119f1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-25 Richard Biener <rguenther@suse.de> + + PR middle-end/81505 + * gcc.dg/ubsan/pr81505.c: New testcase. + 2017-07-24 Daniel Santos <daniel.santos@pobox.com> 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 0000000..1cebef5 --- /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; +} |