gcc auto-omit-frame-pointer vs msvc longjmp

Richard Henderson rth@twiddle.net
Thu Oct 20 04:18:00 GMT 2011

On 10/19/2011 02:05 PM, Bob Breuer wrote:
> Is it possible to force a
> stackframe by just adding a suitable attribute to either the setjmp
> function prototype, or the function which calls setjmp?

The only thing I can think of that'll be portable to a large number
of versions of GCC is

    int n; char *p;
    asm("" : "=r"(n) : "0"(1));
    p = __builtin_alloca(n);
    asm("" : : "r"(p));

The first asm prevents constant propagation of the 1 to the alloca;
the second asm prevents the alloca from being considered dead code.


More information about the Gcc mailing list