aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-07-25 07:04:07 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-07-25 07:04:07 +0000
commit3d99332b9a3fb72aca3c724949cb5373858245cf (patch)
tree6ae53eef543af749b8dd916ddea68a34c9d5b6ed /gcc/fold-const.c
parent7ad5808da9f37f615e0d7ee585b89d1ba1a02264 (diff)
downloadgcc-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/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 2 insertions, 2 deletions
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;
}