aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-04-10 13:02:12 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-04-10 13:02:12 +0000
commit737237c9b8a6e24949975433a5696d4f12d602db (patch)
tree56bff97fd0b8927570019c435feb7520faeb0cba /gcc/fold-const.c
parent541e0d5597169aa3c6ccbfea58df76838db69e28 (diff)
downloadgcc-737237c9b8a6e24949975433a5696d4f12d602db.zip
gcc-737237c9b8a6e24949975433a5696d4f12d602db.tar.gz
gcc-737237c9b8a6e24949975433a5696d4f12d602db.tar.bz2
re PR middle-end/80362 (gcc miscompiles arithmetic with signed char)
2017-04-10 Richard Biener <rguenther@suse.de> PR middle-end/80362 * fold-const.c (fold_binary_loc): Look at unstripped ops when looking for NEGATE_EXPR in -A / -B to A / B folding. * gcc.dg/torture/pr80362.c: New testcase. From-SVN: r246805
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index b4c117c..524bb0f 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -10205,7 +10205,7 @@ fold_binary_loc (location_t loc,
/* Convert -A / -B to A / B when the type is signed and overflow is
undefined. */
if ((!INTEGRAL_TYPE_P (type) || TYPE_OVERFLOW_UNDEFINED (type))
- && TREE_CODE (arg0) == NEGATE_EXPR
+ && TREE_CODE (op0) == NEGATE_EXPR
&& negate_expr_p (op1))
{
if (INTEGRAL_TYPE_P (type))