<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:isanbard@gmail.com" title="Bill Wendling <isanbard@gmail.com>"> <span class="fn">Bill Wendling</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - wrong code (SIGFPE) at -O3 on x86_64-linux-gnu (in 32-bit mode)"
href="http://llvm.org/bugs/show_bug.cgi?id=17073">bug 17073</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - wrong code (SIGFPE) at -O3 on x86_64-linux-gnu (in 32-bit mode)"
href="http://llvm.org/bugs/show_bug.cgi?id=17073#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - wrong code (SIGFPE) at -O3 on x86_64-linux-gnu (in 32-bit mode)"
href="http://llvm.org/bugs/show_bug.cgi?id=17073">bug 17073</a>
from <span class="vcard"><a class="email" href="mailto:isanbard@gmail.com" title="Bill Wendling <isanbard@gmail.com>"> <span class="fn">Bill Wendling</span></a>
</span></b>
<pre>The SIGFPE is correct. See the comments:
int a, b, d, e, *f = &b, g, i;
char c;
int main() {
/* '&c == (void*)&a' is false */
bar (&c == (void *)&a);
return 0;
}
void bar(int p) {
/* 'p' is 0 */
lbl:
if (*f)
g = 0;
int **l = &f;
*l = 0;
for (; i < 1; i++)
{
if (i)
/* i == 1 */
goto lbl;
/* 'd == 0' and 'p == 0' (see above)
* Therefore, this call is 'foo(2, 0)'
*/
if (foo (2, d || p))
{
int **m = &f;
*m = &e;
}
/* i == 1 */
}
}
int foo(int p1, long long p2) {
/* 'p1 == 2' and 'p2' == 0
* This implies 'p1 % p2' is UB.
*/
return p2 == 0 ? 0 : p1 % p2;
}
So, it looks like it's valid for it to have a SIGFPE. The other optimization
levels don't convert to the same code (of course). It results in either the '%'
never being called or possibly never emitted.</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>