g++.old-deja/g++.mike/p7325.C - suspected bogus test case
Zack Weinberg
zack@codesourcery.com
Sat Jun 26 19:18:00 GMT 2004
Mark Mitchell <mark@codesourcery.com> writes:
>>Let me reiterate that: it does not test anything meaningful. It
>>currently passes or fails depending on details of the platform ABI.
>>Worse, the compiler is within its rights to extend the lifetimes of
>>the temporaries because it notices that their addresses have been
>> taken. In fact, I expect Ken Zadeck's better alias analysis will
>> have that effect.
>>
> Why do you expect that? Independently of whether or not their
> addresses have been taken, the language says these temporaries go away
> at a particular point. If the compiler extends their lifetimes
> unnecessarily because it thinks that pointers to them might survive,
> that's an unnecessary pessimization -- unless it has some other good
> reason for doing that.
It seemed a plausible consequence of the interprocedural escape
analysis that he was describing. Sure, the language says these
temporaries go away at a particular point, but the data-flow analysis
says their addresses are preserved, so the conservative optimization
decision is not to recycle the storage. We might choose to do it
anyway, of course ... which I think only supports my point that this
isn't an effective test for stack slot reuse.
> I agree that this an ugly mechanism for testing for this optimization,
> and that some kind of stack-frame dumping might be better. On the
> other hand, we don't have a way of doing that at present. And this
> test does test for an optimization that we want to do, in general.
I don't see it as an effective test for that optimization. At all.
(I do agree that this is an optimization we want to do and currently
don't.)
zw
More information about the Gcc
mailing list