[google gcc-4_8] LIPO: insert static vars to varpool
Hi, For google gcc-4_8 branch only. This is fixes the NULL pointer dereference in copy_tree_r due to empty varpool_node returned. Passed the ICE compilation. Other tests are ongoing. Thanks, -Rong 2013-10-14 Rong Xu x...@google.com * cp/semantics.c (finish_compound_literal): Put static var to varpool. This is for LIPO only. * cp/call.c (make_temporary_var_for_ref_to_temp): Ditto. Index: cp/semantics.c === --- cp/semantics.c (revision 203471) +++ cp/semantics.c (working copy) @@ -2486,6 +2486,10 @@ finish_compound_literal (tree type, tree compound_ decl = pushdecl_top_level (decl); DECL_NAME (decl) = make_anon_name (); SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl)); + /* Capture the current module info for statics. */ + if (L_IPO_COMP_MODE) +varpool_node_for_decl (decl); + return decl; } else Index: cp/call.c === --- cp/call.c (revision 203471) +++ cp/call.c (working copy) @@ -9047,6 +9047,9 @@ make_temporary_var_for_ref_to_temp (tree decl, tre tree name; TREE_STATIC (var) = TREE_STATIC (decl); + /* Capture the current module info for statics. */ + if (L_IPO_COMP_MODE TREE_STATIC (var)) +varpool_node_for_decl (var); DECL_TLS_MODEL (var) = DECL_TLS_MODEL (decl); name = mangle_ref_init_variable (decl); DECL_NAME (var) = name;
Re: [google gcc-4_8] LIPO: insert static vars to varpool.
ok. David On Mon, Oct 14, 2013 at 2:58 PM, Rong Xu x...@google.com wrote: Hi, For google gcc-4_8 branch only. This is fixes the NULL pointer dereference in copy_tree_r due to empty varpool_node returned. Passed the ICE compilation. Other tests are ongoing. Thanks, -Rong 2013-10-14 Rong Xu x...@google.com * cp/semantics.c (finish_compound_literal): Put static var to varpool. This is for LIPO only. * cp/call.c (make_temporary_var_for_ref_to_temp): Ditto. Index: cp/semantics.c === --- cp/semantics.c (revision 203471) +++ cp/semantics.c (working copy) @@ -2486,6 +2486,10 @@ finish_compound_literal (tree type, tree compound_ decl = pushdecl_top_level (decl); DECL_NAME (decl) = make_anon_name (); SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl)); + /* Capture the current module info for statics. */ + if (L_IPO_COMP_MODE) +varpool_node_for_decl (decl); + return decl; } else Index: cp/call.c === --- cp/call.c (revision 203471) +++ cp/call.c (working copy) @@ -9047,6 +9047,9 @@ make_temporary_var_for_ref_to_temp (tree decl, tre tree name; TREE_STATIC (var) = TREE_STATIC (decl); + /* Capture the current module info for statics. */ + if (L_IPO_COMP_MODE TREE_STATIC (var)) +varpool_node_for_decl (var); DECL_TLS_MODEL (var) = DECL_TLS_MODEL (decl); name = mangle_ref_init_variable (decl); DECL_NAME (var) = name;