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]

Re: tail call optimizations


>>>>> 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

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