This is the mail archive of the gcc@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: forcing tail/sibling call optimization


  In message <20001126161445.8878634D82@nile.gnat.com>you write:
  > The formal definition seems quite reasonable here, but I must say
  > I dislike the syntax, and it is unnecessarily provocative, since
  > this really is not semantically a goto at all (e.g. the formal
  > denmotational semantics would have nothing to do with the semantics
  > of goto). Why not something like "tail return" or perhaps better 
  > simply a compiler directive.
  > 
  > The real point here is that the semantics is identical to return. What
  > the declaration (in whatever form it exists) is doing is to say that
  > the semanjtics of execution will be undefined if there are any subsequent
  > references to local variables of the caller. That's *all* that needs to
  > be said semantically.
  > 
  > In Ada, one would provide this capability by simply having a pragma
  > e.g. pragma Tail_Return; which has no effect on the semantics of the
  > program if it is correct.
Instead of tagging the return itself, couldn't we use an attribute which
would (in effect) tell the optimizer that any tail call in the function
is safe to optimize?  Yes, we lose the ability to specify that a specific
call site is safe to optimize, but we don't have to invent yet another
GCC extension of dubious value.

jeff


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