This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR66705


> > supplied by foreign code, so you need to be conservative anyway.
> 
> I use all_refs_explicit_p () to go a conservative path.  And indeed

Yep, that should be safe.

I guess you want two things
 1) discover any possible ADDR_REF of a given symbol with all_refs_explicit_p.
    For that you want walk referring list of the symbol or if you go forward
    direction walk all initializers of all non-aliases you can see as all of them
    may possibly reffer to it.
 2) discover what static variables you have fully in control and know all
    references to.  I suppose that is where you use all_refs_explicit_p
    Explicit reference may be also an alias that may be exported.
    all_refs_explicit_p cares about symbol, not about the initializer itself,
    so you may want to have a version of this predicate that walks all aliases
    and checks that all of them have all refs explicit.

> I may trip aliases (well, the code doesn't handle aliases correctly
> anyway I guess - I just walk vars via
> 
>   /* Create constraints for global variables and their initializers.  */
>   FOR_EACH_VARIABLE (var)
>     {
>       if (var->alias && var->analyzed)
>         continue;
> 
>       get_vi_for_tree (var->decl);
>     }
> 
> and in get_vi_for_tree look at its ref list.  So I should only get
> "ultimate" alias targets and only those may have initializers?

Yep, only ulitmate alias targets have initializers.

Honza
> 
> Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]