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: proper tail recursion for gcc


On Thu, Jul 20, 2000 at 11:21:51AM +0000, Mark Probst wrote:
> i was referring to exactly this optimization. at least on the alpha,
> for example, only calls to static functions are optimized, which is
> not very helpful if you need separate compilation.

This is required by the calling conventions.

Given foo calls bar calls baz, if baz function is in a different file
than bar, it might use a different $gp value.  If baz uses a different
$gp value, then the $gp value on return to foo will be incorrect and
foo may crash.

There is no way around this, except foreknowledge that bar and baz
use the same $gp value.  And that may only be guaranteed by putting
the functions in the same translation unit.



r~

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