http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59039
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2013-11-07 Ever confirmed|0 |1 --- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Richard Biener from comment #1) > __builtin_longjmp/setjmp are just longjmp(3) setjmp(3) with their > constraints. > They should not be used directly but <setjmp.h> should be. That was my first impression. But I saw [hjl@gnu-hsw-1 tmp]$ cat y.c #include <setjmp.h> extern jmp_buf buf; void foo () { __builtin_setjmp (buf); } void bar () { __builtin_longjmp (buf, 1); } [hjl@gnu-hsw-1 tmp]$ gcc -S -O2 y.c [hjl@gnu-hsw-1 tmp]$ cat y.s .file "y.c" .text .p2align 4,,15 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc movq %rsp, buf(%rip) movq $.L2, buf+8(%rip) movq %rsp, buf+16(%rip) ret .L2: .L4: .cfi_endproc .LFE0: .size foo, .-foo .p2align 4,,15 .globl bar .type bar, @function bar: .LFB1: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq buf+8(%rip), %rax movq %rsp, %rbp .cfi_def_cfa_register 6 movq buf(%rip), %rbp movq buf+16(%rip), %rsp jmp *%rax .cfi_endproc .LFE1: .size bar, .-bar __builtin_longjmp/setjmp only save/restore BP, SP and PC on x86, x32 and x86-64.