From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen To: law@redhat.com Cc: gcc@gcc.gnu.org Subject: Re: forcing tail/sibling call optimization Date: Mon, 27 Nov 2000 08:07:00 -0000 Message-id: References: <32243.975340713@upchuck> X-SW-Source: 2000-11/msg01175.html 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. -Andi