<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - __builtin_longjmp/__builtin_setjmp don't work with -O"
href="https://bugs.llvm.org/show_bug.cgi?id=45403">45403</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__builtin_longjmp/__builtin_setjmp don't work with -O
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>9.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hjl.tools@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, xiang1.zhang@intel.com
</td>
</tr></table>
<p>
<div>
<pre>---
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@gnu-tgl-1 i386]$ clang -o /tmp/x cet-sjlj-1.c -O2
[hjl@gnu-tgl-1 i386]$ /tmp/x
Aborted (core dumped)
[hjl@gnu-tgl-1 i386]$ gcc -o /tmp/x cet-sjlj-1.c -O2
[hjl@gnu-tgl-1 i386]$ /tmp/x
[hjl@gnu-tgl-1 i386]$</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>