aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2003-08-04 23:46:34 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2003-08-04 23:46:34 +0000
commit02a1994cbad7e89f535ee982c80def2bd6e7d9bf (patch)
tree9c669844e1a60281f0d3d519b7d1aa95ce112ec3 /gcc/fold-const.c
parentf2593a6649384b002184762c58b083eb5f8e939f (diff)
downloadgcc-02a1994cbad7e89f535ee982c80def2bd6e7d9bf.zip
gcc-02a1994cbad7e89f535ee982c80def2bd6e7d9bf.tar.gz
gcc-02a1994cbad7e89f535ee982c80def2bd6e7d9bf.tar.bz2
re PR middle-end/11771 (Segfault with simple double arithmetics)
PR middle-end/11771 * fold-const.c (negate_expr_p <MINUS_EXPR>): Change to match the logic in negate_expr, i.e. we don't invert (A-B) for floating point types unless flag_unsafe_math_optimizations. * gcc.c-torture/compile/20030804-1.c: New test case. From-SVN: r70159
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 4dd606f..9333c59 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -841,9 +841,12 @@ negate_expr_p (tree t)
case REAL_CST:
case NEGATE_EXPR:
- case MINUS_EXPR:
return true;
+ case MINUS_EXPR:
+ /* We can't turn -(A-B) into B-A when we honor signed zeros. */
+ return ! FLOAT_TYPE_P (type) || flag_unsafe_math_optimizations;
+
default:
break;
}