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]
Other format: [Raw text]

Re: gcc auto-omit-frame-pointer vs msvc longjmp


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.


r~


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