This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR66705
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Biener <rguenther at suse dot de>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 3 Sep 2015 10:50:12 +0200
- Subject: Re: [PATCH] Fix PR66705
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1509021456160 dot 5523 at zhemvz dot fhfr dot qr> <20150902130338 dot GA96189 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1509021526310 dot 5523 at zhemvz dot fhfr dot qr> <alpine dot LSU dot 2 dot 11 dot 1509021545020 dot 5523 at zhemvz dot fhfr dot qr> <20150902142302 dot GA44165 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1509021629230 dot 5523 at zhemvz dot fhfr dot qr>
> > 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.