This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[google gcc-4_8] LIPO: insert static vars to varpool
- From: Rong Xu <xur at google dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: David Li <davidxl at google dot com>
- Date: Mon, 14 Oct 2013 15:00:03 -0700
- Subject: [google gcc-4_8] LIPO: insert static vars to varpool
- Authentication-results: sourceware.org; auth=none
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 <xur@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;