This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [google gcc-4_8] LIPO: insert static vars to varpool.
- From: Xinliang David Li <davidxl at google dot com>
- To: Rong Xu <xur at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 14 Oct 2013 15:01:23 -0700
- Subject: Re: [google gcc-4_8] LIPO: insert static vars to varpool.
- Authentication-results: sourceware.org; auth=none
- References: <CAF1bQ=TKb3kS0dqP36YdLv__M6Soy=AVWjnpv2QdkBZh-a7cQw at mail dot gmail dot com>
ok.
David
On Mon, Oct 14, 2013 at 2:58 PM, Rong Xu <xur@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 <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;
>