This is the mail archive of the 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]

[lto][patch] Fix struct reorg bug

Currently the code tries to insert the newly created statements after
the last of the newly created statements :-) That fails since the new
statements don't have a basic block yet.

We are not getting any SSA names in the tests, so new_stmts is always
empty. Reordering some passes brings this bug to life.

Is this patch also OK for trunk during stage3?

2008-10-22 Rafael Espindola  <>

	* ipa-struct-reorg.c (create_new_alloc_sites): Properly insert the
	newly created statements.

Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index d6bca8a..d1d7b1c 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -2114,8 +2114,9 @@ create_new_alloc_sites (fallocs_t m_data, tree context)
       num = gen_num_of_structs_in_malloc (stmt, str->decl, &new_stmts);
       if (new_stmts)
-	  last_stmt = gimple_seq_last_stmt (new_stmts);
+	  gimple last_stmt_tmp = gimple_seq_last_stmt (new_stmts);
 	  insert_seq_after_stmt (last_stmt, new_stmts);
+	  last_stmt = last_stmt_tmp;
       /* Generate an allocation sites for each new structure type.  */      

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