[RFA] Avoid non-static&external vars in varpool

H.J. Lu hjl.tools@gmail.com
Sat Jan 15 17:53:00 GMT 2011

On Thu, Sep 2, 2010 at 12:28 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> this patch fixes problem with gfortran adding local var into varpool.  I first considered
> it to be bug in the frontend, but rest_of_decl_compilation comment seems to agree with fortran's
> behaviour:
>   This is called from various places for FUNCTION_DECL, VAR_DECL,
>   and TYPE_DECL nodes.
>   This does nothing for local (non-static) variables, unless the
>   variable is a register variable with DECL_ASSEMBLER_NAME set.  In
>   that case, or if the variable is not an automatic, it sets up the
>   RTL and outputs any assembler code (label definition, storage
>   allocation and initialization).
> So this patch makes it really no-op on local vars and also adds sanity check to varpool.
> Bootstrapped and regtested x86_64-linux, OK?
> Honza
>        * passes.c (rest_of_decl_compilation): Do not add local vars into varpol.
>        * varpool.c (varpool_get_node, varpool_node): Sanity check that only
>        static or extern vars are in varpool.
>        (varpool_finalize_decl): Sanity check that only static vars are finalized.

This caused:



More information about the Gcc-patches mailing list