This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch for complex conjugation of constants
- To: <gcc-patches at gcc dot gnu dot org>
- Subject: Patch for complex conjugation of constants
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Thu, 4 Jan 2001 19:33:41 +0000 (GMT)
This patch fixes my PR c/1501 (complex conjugation of constants is
broken with tree checking - though it looks like it would work
accidentally without tree checking on 32-bit systems, this perhaps
being why the brokenness wasn't obvious long ago). Testcase
gcc.c-torture/compile/20001222-1.c.
Bootstrapped with no regressions on i686-pc-linux-gnu. OK to commit?
2001-01-04 Joseph S. Myers <jsm28@cam.ac.uk>
* fold-const.c (fold): When folding a CONJ_EXPR of a COMPLEX_CST,
use TREE_REALPART and TREE_IMAGPART instead of TREE_OPERAND.
2001-01-04 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.c-torture/compile/20001222-1.x: Remove.
--- fold-const.c.orig Wed Jan 3 18:58:44 2001
+++ fold-const.c Thu Jan 4 14:16:20 2001
@@ -5278,8 +5278,8 @@ fold (expr)
TREE_OPERAND (arg0, 0),
negate_expr (TREE_OPERAND (arg0, 1)));
else if (TREE_CODE (arg0) == COMPLEX_CST)
- return build_complex (type, TREE_OPERAND (arg0, 0),
- negate_expr (TREE_OPERAND (arg0, 1)));
+ return build_complex (type, TREE_REALPART (arg0),
+ negate_expr (TREE_IMAGPART (arg0)));
else if (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR)
return fold (build (TREE_CODE (arg0), type,
fold (build1 (CONJ_EXPR, type,
--- testsuite/gcc.c-torture/compile/20001222-1.x Fri Dec 22 20:02:51 2000
+++ testsuite/gcc.c-torture/compile/20001222-1.x Fri Sep 11 11:31:59 1998
@@ -1,2 +0,0 @@
-set torture_compile_xfail "*-*-*"
-return 0
--
Joseph S. Myers
jsm28@cam.ac.uk