public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [tuples] Fix constructor initializers
@ 2007-07-30 19:34 Diego Novillo
  0 siblings, 0 replies; only message in thread
From: Diego Novillo @ 2007-07-30 19:34 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]


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.



[-- Attachment #2: 20070730-fix-construtor-init.diff --]
[-- Type: text/x-patch, Size: 913 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-30 19:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-30 19:34 [tuples] Fix constructor initializers Diego Novillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).