diff options
author | Roger Sayle <roger@eyesopen.com> | 2003-08-04 23:46:34 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2003-08-04 23:46:34 +0000 |
commit | 02a1994cbad7e89f535ee982c80def2bd6e7d9bf (patch) | |
tree | 9c669844e1a60281f0d3d519b7d1aa95ce112ec3 /gcc/fold-const.c | |
parent | f2593a6649384b002184762c58b083eb5f8e939f (diff) | |
download | gcc-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.c | 5 |
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; } |