diff options
author | Richard Guenther <rguenther@suse.de> | 2007-11-17 14:22:42 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2007-11-17 14:22:42 +0000 |
commit | a0857153ddb27ba0f64a16c934734421fd2fccfc (patch) | |
tree | 4cc0357f812980dd1458b9f0f76df27daf5952c2 /gcc/fold-const.c | |
parent | d61ae8dd9925ebc662f09837013e0a03bcc353f5 (diff) | |
download | gcc-a0857153ddb27ba0f64a16c934734421fd2fccfc.zip gcc-a0857153ddb27ba0f64a16c934734421fd2fccfc.tar.gz gcc-a0857153ddb27ba0f64a16c934734421fd2fccfc.tar.bz2 |
re PR middle-end/34130 (the builtin abs() gives wrong result when used in some expression)
2007-11-17 Richard Guenther <rguenther@suse.de>
PR middle-end/34130
* fold-const.c (extract_muldiv_1): Do not move negative
constants inside ABS_EXPR.
* gcc.c-torture/execute/pr34130.c: New testcase.
From-SVN: r130258
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1057d26..1c03f30 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6095,6 +6095,9 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type, } break; } + /* If the constant is negative, we cannot simplify this. */ + if (tree_int_cst_sgn (c) == -1) + break; /* FALLTHROUGH */ case NEGATE_EXPR: if ((t1 = extract_muldiv (op0, c, code, wide_type, strict_overflow_p)) |