[llvm-bugs] [Bug 45403] New: __builtin_longjmp/__builtin_setjmp don't work with -O
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Apr 2 11:10:29 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45403
Bug ID: 45403
Summary: __builtin_longjmp/__builtin_setjmp don't work with -O
Product: new-bugs
Version: 9.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: hjl.tools at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
xiang1.zhang at intel.com
---
void *buf[5];
extern void abort (void);
void raise0(void)
{
__builtin_longjmp (buf, 1);
}
int execute(int cmd)
{
int last = 0;
if (__builtin_setjmp (buf) == 0)
while (1)
{
last = 1;
raise0 ();
}
if (last == 0)
return 0;
else
return cmd;
}
int main(void)
{
if (execute (1) == 0)
abort ();
return 0;
}
---
[hjl at gnu-tgl-1 i386]$ clang -o /tmp/x cet-sjlj-1.c -O2
[hjl at gnu-tgl-1 i386]$ /tmp/x
Aborted (core dumped)
[hjl at gnu-tgl-1 i386]$ gcc -o /tmp/x cet-sjlj-1.c -O2
[hjl at gnu-tgl-1 i386]$ /tmp/x
[hjl at gnu-tgl-1 i386]$
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200402/4bb177b1/attachment.html>
More information about the llvm-bugs
mailing list