On Sun, Dec 12, 2021 at 06:08:06PM +0000, Jonathan Wakely wrote: > On Sun, 12 Dec 2021, 17:34 Segher Boessenkool, <segher@xxxxxxxxxxxxxxxxxxx> > wrote: > > On Fri, Dec 10, 2021 at 03:40:30PM -0700, Jeff Law wrote: > > > On 12/9/2021 6:06 PM, Marc Feeley wrote: > > > > #if __has_attribute(tail_call_supported_on_this_architecture) > > > > /* use tail calls for jumping around... */ > > > > #else > > > > /* use trampoline fallback... */ > > > > #endif > > > Which is the fundamental problem. GCC simply doesn't have the concept > > > that "this must be implemented as a tail call". > > > > All architecture support tail calls, and all architectures do not > > support them everywhere: for some code GCC will not do a tail call on > > any architecture. > > > > An attribute that means "sorry() if you cannot do a tail call here" (or > > "on any call to this function") can be implemented, and will work fine > > in practice for all users, in my estimation. > > That seems roughly analogous to always_inline. Yes indeed, good example :-) This will be implemented very late in the pass pipeline instead of very early, but that does not matter for what the user sees. Segher