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 call-clobbering (PRs 36373 and 36387)


On Sat, May 31, 2008 at 5:46 AM, Richard Guenther <rguenther@suse.de> wrote:
> On Fri, 30 May 2008, Daniel Berlin wrote:
>
>> On Fri, May 30, 2008 at 6:12 PM, Richard Guenther <rguenther@suse.de> wrote:
>> >
>> > Second, we miss to compute the reachability set of the
>> > escaped pointers and only clobber the directly pointed-to
>> > memory.
>>
>> This is because points-to is not computing the reachability of the
>> anything variable properly.
>
> No.  points-to is not supposed to compute reachability.  points-to
> is supposed to compute points-to, no?

Depends on what you mean by "reachability".

>
> The case in question is that for
>
>  int i;
>  int *p = &i;
>  int **q = &p;
>  foo (q);
>
> points-to computes the points-to set of p to be { i } (ok, it doesn't
> because of the "fix" in handle_rhs_call, but you get the idea).

The points-to set there  is clearly wrong.  Points-to's results need
to be correct in all cases, the above is not correct, becasue we do
not know (lacking IPA) what p points to anymore :).


>
> And it cannot really do better unless you add constraints for call-sites
> that make all _reachable_ memory point to anything.

Which is exactly what is supposed to happen.

>But as points-to
> is not about reachability we can just ignore that here and fix-up
> the points-to set after computing the reachability set of the escapes
> by doing
>

Ignoring that here and fixing it up later is exactly what i am
objecting to.  Points-to should get the right answer here, which is
that after the call, we do not know what p points to.

> Interesting idea.  But there is no q = &ANYTHING constraint (IMHO there
> shouldn't be).  For the example above (let's assume handle_rhs_call
> wouldn't exist)

There already is a q = &ANYTHING constraint, prior to any patch.
We assume escaping variables point to anything, as we must.

> I didn't look at the solver part at all (I assume you got that right),
> but only at the constraints we generate and at the various papers
> (of which most circumvent the call problem by not mentioning them or
> doing IPA-PTA only ...).  It seems to me the solver part never
> transitively closes anything but copies - that is,

Uh, i'm not sure what you think it is doing, but the whole purpose of
points-to solver is to compute the transitive closure of the initial
set of constraints. :)

It doesn't construct a transitive closure of the *graph* because it's
not necessary to do this.
We only add edges to the graph necessary to make reachability right
(search for add_graph_edge in do_*), then propagate through graph
reachability in order to get the results.

>
> Richard.
>


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