From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeffrey A Law To: Andi Kleen Cc: gcc@gcc.gnu.org Subject: Re: forcing tail/sibling call optimization Date: Mon, 27 Nov 2000 08:25:00 -0000 Message-id: <32480.975342366@upchuck> References: X-SW-Source: 2000-11/msg01176.html In message < oupn1el760c.fsf@pigdrop.muc.suse.de >you write: > 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. Therein lies the first problem -- programmer dependence on specific optimizations in the compiler. That's a fundamental mistake. If you _must_ have tail calls optimized to gotos, then write them that way or use a language which guarantees tail calls will turn into gotos. If tail call optimizations are merely convenience, then write them as calls :-) > 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. True. > With the functio > wide attribute it would be much harder to enforce it. Every call could > possible be a tail call depending on rather complex, machine dependent rule True. > 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. I don't think there really is a way. Nor do I think we should spend a lot of time worrying about it :-) jeff