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]

[tuples] Fix constructor initializers


This fixes the gimplification of constructor initializers.  Before we
could get away with leaving the two sides of the MODIFY_EXPR in GIMPLE
form, now we have to actually emit an assignment.


2007-07-30  Diego Novillo  <dnovillo@google.com>

	* gimplify.c (gimplify_init_constructor): If both sides
	of the constructor are in GIMPLE form but the assignment
	has not been emitted, emit it.

Index: gimplify.c
===================================================================
--- gimplify.c	(revision 127018)
+++ gimplify.c	(working copy)
@@ -3384,7 +3384,20 @@ gimplify_init_constructor (tree *expr_p,
       return GS_OK;
     }
   else
-    return GS_ALL_DONE;
+    {
+      /* If we have gimplified both sides of the initializer but have
+	 not emitted an assignment, do so now.  */
+      if (*expr_p)
+	{
+	  tree lhs = TREE_OPERAND (*expr_p, 0);
+	  tree rhs = TREE_OPERAND (*expr_p, 1);
+	  gimple init = build_gimple_assign (lhs, rhs);
+	  gimple_add (pre_p, init);
+	  *expr_p = NULL;
+	}
+
+      return GS_ALL_DONE;
+    }
 }
 
 /* Given a pointer value OP0, return a simplified version of an

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