This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Google] fix a bug in lipo varpool node linking
- 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: Fri, 16 Aug 2013 14:37:04 -0700
- Subject: Re: [Google] fix a bug in lipo varpool node linking
- References: <CAF1bQ=RgU3+iSqT1TTuWqJ-5U+tR1Qr9DLCedDMnbM_kCuApAQ at mail dot gmail dot com>
ok.
David
On Fri, Aug 16, 2013 at 1:28 PM, Rong Xu <xur@google.com> wrote:
> This patch fixed a bug in lipo varpool node linking.
>
> C++ FE drops the initializer if it's not used in this TU. For current
> varpool linking may
> resolve the varpool node to the one with null initializer.
>
> -Rong
>
>
> Index: l-ipo.c
> ===================================================================
> --- l-ipo.c (revision 201800)
> +++ l-ipo.c (working copy)
> @@ -2151,6 +2151,19 @@ resolve_varpool_node (struct varpool_node **slot,
> return;
> }
>
> + if (DECL_INITIAL (decl1) && !DECL_INITIAL (decl2))
> + {
> + merge_addressable_attr (decl1, decl2);
> + return;
> + }
> +
> + if (!DECL_INITIAL (decl1) && DECL_INITIAL (decl2))
> + {
> + *slot = node;
> + merge_addressable_attr (decl2, decl1);
> + return;
> + }
> +
> /* Either all complete or neither's type is complete. Just
> pick the primary module's decl. */
> if (!varpool_is_auxiliary (*slot))