<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - clang crashes on valid code at -O2 and -O3 in 32-bit mode on x86_64-linux-gnu"
href="http://llvm.org/bugs/show_bug.cgi?id=18045">18045</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang crashes on valid code at -O2 and -O3 in 32-bit mode on x86_64-linux-gnu
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>su@cs.ucdavis.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The current clang trunk crashes when compiling the following testcase at -O2
and -O3 in 32-bit mode (but not 64-bit mode) on x86_64-linux-gnu.
This is a regression from clang 3.3.
The "main" could certainly be removed, but beyond that, this is the simplest I
could get so far.
$ clang-trunk -v
clang version 3.5 (trunk 195569)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
$
$ clang-trunk -m32 -Os small.c; a.out
$ clang-trunk -m64 -O2 small.c; a.out
$ clang-3.3 -m32 -O2 small.c; a.out
$
$ clang-trunk -m32 -O2 small.c
fatal error: error in backend: Cannot select: 0x4200920: v4i32,ch = load
0x41d6ab0, 0x4205850,
0x41dcb10<LD16[getelementptr inbounds ([4 x i32]* @e, i32 0, i32
0)](align=4)> [ORD=82]
[ID=58]
0x4205850: i32 = X86ISD::Wrapper 0x41d5490 [ORD=26] [ID=43]
0x41d5490: i32 = TargetGlobalAddress<[4 x i32]* @e> 0 [ORD=26] [ID=23]
0x41dcb10: i32 = undef [ID=2]
In function: fn3
clang: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 3.5 (trunk 195569)
Target: i386-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/small-85844e.c
clang: note: diagnostic msg: /tmp/small-85844e.sh
clang: note: diagnostic msg:
********************
$
-----------------------------------------
int a, b, c, d, e[4], f[4], g, h, i, j, l;
short k;
char
fn1 (int p)
{
return p + a;
}
int
fn2 (int p1, int p2)
{
return 1 ^ -p2 ^ p2 ? 0 : p1 - 1;
}
void
fn3 ()
{
for (l = 0; l < 1; l++)
if (i)
for (h = 0; h < 4; h++)
{
k = c * d;
j = k * b;
f[h] = fn2 (e[h],
((f[h] >= 0) <=
(g >= fn1 (e[3] < (d = (j ^ 1) < 1)))) & e[h]);
}
}
int
main ()
{
fn3 ();
return 0;
}</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>