public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/59039] Undocumented __builtin_longjmp/__builtin_setjmp
Date: Thu, 07 Nov 2013 14:53:00 -0000 [thread overview]
Message-ID: <bug-59039-4-rw9PvJYFkJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59039-4@http.gcc.gnu.org/bugzilla/>
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.
next prev parent reply other threads:[~2013-11-07 14:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-07 12:51 [Bug other/59039] New: " hjl.tools at gmail dot com
2013-11-07 14:49 ` [Bug other/59039] " rguenth at gcc dot gnu.org
2013-11-07 14:52 ` rguenth at gcc dot gnu.org
2013-11-07 14:53 ` hjl.tools at gmail dot com [this message]
2013-11-07 14:59 ` [Bug c/59039] " rguenth at gcc dot gnu.org
2013-11-07 15:02 ` rguenth at gcc dot gnu.org
2013-11-07 15:03 ` hjl.tools at gmail dot com
2013-11-07 15:16 ` ebotcazou at gcc dot gnu.org
2013-11-07 15:32 ` hjl.tools at gmail dot com
2013-11-07 15:49 ` ebotcazou at gcc dot gnu.org
2013-11-07 16:27 ` hjl.tools at gmail dot com
2013-11-07 17:18 ` ebotcazou at gcc dot gnu.org
2013-11-07 22:54 ` ebotcazou at gcc dot gnu.org
2013-11-07 22:56 ` hjl.tools at gmail dot com
2013-11-08 8:47 ` rguenth at gcc dot gnu.org
2013-11-08 10:21 ` hjl.tools at gmail dot com
2013-11-08 10:53 ` ebotcazou at gcc dot gnu.org
2013-11-08 16:52 ` hjl.tools at gmail dot com
2013-11-08 19:15 ` schwab@linux-m68k.org
2013-11-08 19:52 ` bviyer at gcc dot gnu.org
2013-11-08 21:05 ` hjl.tools at gmail dot com
2013-11-09 12:33 ` ebotcazou at gcc dot gnu.org
2014-01-06 17:40 ` rth at gcc dot gnu.org
2014-01-07 9:09 ` ebotcazou at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-59039-4-rw9PvJYFkJ@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).