This is the mail archive of the 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

Jeffrey A Law <> writes:
>   > 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.

Problem I see with that is diagnostics again: e.g. someone depends on a 
particular call being a tail call and not allocating new storage. With a 
"tail call statement" gcc could easily give a warning or even an error
when the compiler is not able to satisfy that requirement. With the function
wide attribute it would be much harder to enforce it. Every call could
possible be a tail call depending on rather complex, machine dependent rules.
How would you generate the "not a tail call" warning without getting lots
of false positives? With an explicit statement it is clear what to do. 


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