This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: tail call optimizations
- To: law at cygnus dot com
- Subject: Re: tail call optimizations
- From: Jason Merrill <jason at cygnus dot com>
- Date: 23 Mar 2000 11:53:10 -0800
- Cc: Geoff Keating <geoffk at cygnus dot com>, gcc-patches at gcc dot gnu dot org
- References: <16553.953830511@upchuck>
>>>>> Jeffrey A Law <law@cygnus.com> writes:
>> Is there a problem I don't see where if you have
>>
>> int foo () { bar(); }
>>
>> and bar() throws, you can't just pass the exception up to foo's
>> caller, just as if foo's caller had called bar directly?
> I'm not sure enough about EH semantics to know if this situation is even
> possible.
> If bar can throw, don't we have to assume that foo can throw?
Yes.
> If so, then no tail call optimization is possible.
Why not? An exception thrown out of bar would just propagate out to foo's
caller, as if it had been thrown from foo.
It doesn't matter if a call can throw; it only matters if we want to try
to catch the exception.
Jason