This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix tree-opt/22116


Thanks to Danny for help identifying the problem.


r~


        PR tree-opt/22116
        * tree-ssa-pre.c (create_expression_by_pieces): Set
        DECL_COMPLEX_GIMPLE_REG_P.
        (insert_into_preds_of_block): Likewise.

Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-pre.c,v
retrieving revision 2.92
diff -u -p -d -r2.92 tree-ssa-pre.c
--- tree-ssa-pre.c	1 Jun 2005 02:51:04 -0000	2.92
+++ tree-ssa-pre.c	19 Jun 2005 06:29:58 -0000
@@ -1593,6 +1593,8 @@ create_expression_by_pieces (basic_block
      that we will return.  */
   temp = create_tmp_var (TREE_TYPE (expr), "pretmp");
   add_referenced_tmp_var (temp);
+  if (TREE_CODE (TREE_TYPE (expr)) == COMPLEX_TYPE)
+    DECL_COMPLEX_GIMPLE_REG_P (temp) = 1;
   newexpr = build (MODIFY_EXPR, TREE_TYPE (expr), temp, newexpr);
   name = make_ssa_name (temp, newexpr);
   TREE_OPERAND (newexpr, 0) = name;
@@ -1699,6 +1701,8 @@ insert_into_preds_of_block (basic_block 
   /* Now build a phi for the new variable.  */
   temp = create_tmp_var (type, tmpname);
   add_referenced_tmp_var (temp);
+  if (TREE_CODE (type) == COMPLEX_TYPE)
+    DECL_COMPLEX_GIMPLE_REG_P (temp) = 1;
   temp = create_phi_node (temp, block);
   NECESSARY (temp) = 0; 
   VEC_safe_push (tree, heap, inserted_exprs, temp);
Index: testsuite/gcc.c-torture/compile/complex-3.c
===================================================================
RCS file: testsuite/gcc.c-torture/compile/complex-3.c
diff -N testsuite/gcc.c-torture/compile/complex-3.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.c-torture/compile/complex-3.c	19 Jun 2005 06:31:47 -0000
@@ -0,0 +1,17 @@
+/* PR 22116 */
+
+void g(_Complex float);
+_Complex float f(int data, _Complex float x, _Complex float y)
+{
+  _Complex float i, t;
+  if (data) 
+  {
+    i = x +  __imag__ y;
+    g(i);
+  }
+  else
+    i = 5;
+  t = x + __imag__ y;
+  g(t);
+  return t * i;
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]