--- Comment #9 from Wilco <wilco at gcc dot> ---
(In reply to Jakub Jelinek from comment #7)
> cfun->has_nonlocal_label instead of cfun->calls_setjmp would cover
> __builtin_setjmp.

Do non-local labels do the same odd thing? It seems to me if the mid-end
automatically inserts explicit writes to the frame pointer, it should also set
frame_pointer_needed. This may be a bug on other targets too.

Also a much better implementation would use a small landing pad in the function
that does the __builtin_setjmp (rather than inline it a different function), so
you avoid the frame pointer corruption. Eg.

        ldr     x1, [x0, 8]
        br      x1

L7_nonlocal: (landing pad in foo)
        ldr     x29, [x0, 16]
        ldr     sp,  [x0]
        b       .L7

Or maybe we should get rid of these horrible hacks altogether?

Reply via email to