aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-complex.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2009-05-08 11:22:08 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2009-05-08 11:22:08 +0100
commit2ca862e9dd939d7dd686b771f401012fb9ed9bfe (patch)
tree0d1b08d95e3e4458bfdcc780995e149747769e39 /gcc/tree-complex.c
parentcb8e4445ef25e1da025712d0595274b297b78ec1 (diff)
downloadgcc-2ca862e9dd939d7dd686b771f401012fb9ed9bfe.zip
gcc-2ca862e9dd939d7dd686b771f401012fb9ed9bfe.tar.gz
gcc-2ca862e9dd939d7dd686b771f401012fb9ed9bfe.tar.bz2
re PR c/24581 (Complex arithmetic on special cases is incorrect.)
PR c/24581 * c-typeck.c (build_binary_op): Handle arithmetic between one real and one complex operand specially. * tree-complex.c (some_nonzerop): Do not identify a real value as zero if flag_signed_zeros. testsuite: * gcc.dg/torture/complex-sign.h: New header. * gcc.dg/torture/complex-sign-add.c, gcc.dg/torture/complex-sign-mixed-add.c, gcc.dg/torture/complex-sign-mixed-div.c, gcc.dg/torture/complex-sign-mixed-mul.c, gcc.dg/torture/complex-sign-mixed-sub.c, gcc.dg/torture/complex-sign-mul.c, gcc.dg/torture/complex-sign-sub.c: New tests. From-SVN: r147281
Diffstat (limited to 'gcc/tree-complex.c')
-rw-r--r--gcc/tree-complex.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 7dbc63a..2835220 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -99,7 +99,10 @@ some_nonzerop (tree t)
{
int zerop = false;
- if (TREE_CODE (t) == REAL_CST)
+ /* Operations with real or imaginary part of a complex number zero
+ cannot be treated the same as operations with a real or imaginary
+ operand if we care about the signs of zeros in the result. */
+ if (TREE_CODE (t) == REAL_CST && !flag_signed_zeros)
zerop = REAL_VALUES_IDENTICAL (TREE_REAL_CST (t), dconst0);
else if (TREE_CODE (t) == FIXED_CST)
zerop = fixed_zerop (t);