Don't allow sibcalls on nested functions

Richard Henderson
Wed Apr 30 23:19:00 GMT 2003

On Mon, Apr 28, 2003 at 12:52:51PM +0200, Olivier Hainque wrote:
>  > The -O2 -gnatp asm output for histograms.adb shows the problem:
>  >
>  > histograms__display:
>  >         st      %o0, [%sp+68]     <========== (1)
>  >
>  >         ld      [%o1], %o0
>  >         sethi   %hi(...__wrapper_for_check_zoom_factor.2), %g1
>  >         jmpl    %g1 + %lo(...__wrapper_for_check_zoom_factor.2), %g0
>  > histograms__display__wrapper_for_check_zoom_factor.2:
>  >         save    %sp, -120, %sp
>  >         st      %i0, [%fp+68]    <========== (4)

Ok, I see now, thanks.

Yes, I agree that this can only happen with one nesting depth.
I also agree that this patch solves the problem.

Ideally we'd note if there are any DECL_NONLOCAL_P parameters
and variables in the outer function, and if there aren't, allow
the tail-call.  This is non-trivial because of having to track
down all the decls involved.

An even further refinement would be to note which variables are
used by which subroutines, but then we're getting into IPA, and
there's *lots* of things we'd like to be able to do there.  ;-)


More information about the Gcc-patches mailing list