tree-sra.c (scalarize_init): Insert the generate_element_init statements after the...
authorRichard Sandiford <rsandifo@nildram.co.uk>
Wed, 2 Jan 2008 13:04:11 +0000 (13:04 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 2 Jan 2008 13:04:11 +0000 (13:04 +0000)
gcc/
* tree-sra.c (scalarize_init): Insert the generate_element_init
statements after the generate_element_zero statements.

From-SVN: r131258

gcc/ChangeLog
gcc/tree-sra.c

index 490dc74140c11fa049cb57678166b9e1e5b4ec61..803461c6284db6c6bbcaf3fa4eb53ee3e2c702eb 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-02  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       * tree-sra.c (scalarize_init): Insert the generate_element_init
+       statements after the generate_element_zero statements.
+
 2008-01-02  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/34093
index 83c5d8a2f09194915ca052320a7689f92a79aab2..9128677dde0493a21fed8c72791f0110d9bf7a63 100644 (file)
@@ -3354,19 +3354,20 @@ static void
 scalarize_init (struct sra_elt *lhs_elt, tree rhs, block_stmt_iterator *bsi)
 {
   bool result = true;
-  tree list = NULL;
+  tree list = NULL, init_list = NULL;
 
   /* Generate initialization statements for all members extant in the RHS.  */
   if (rhs)
     {
       /* Unshare the expression just in case this is from a decl's initial.  */
       rhs = unshare_expr (rhs);
-      result = generate_element_init (lhs_elt, rhs, &list);
+      result = generate_element_init (lhs_elt, rhs, &init_list);
     }
 
   /* CONSTRUCTOR is defined such that any member not mentioned is assigned
      a zero value.  Initialize the rest of the instantiated elements.  */
   generate_element_zero (lhs_elt, &list);
+  append_to_statement_list (init_list, &list);
 
   if (!result)
     {