<html>
<head>
<base href="https://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 generates infinite loop at -O2"
href="https://llvm.org/bugs/show_bug.cgi?id=25895">25895</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang generates infinite loop at -O2
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>Loop Optimizer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>daiweili@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Compiling this code on OSX using clang-3.7.0 with:
clang++ -c -O2 -std=c++11 -stdlib=libc++ -arch arm64 miscompile.cpp
results in code:
$ otool -tV miscompile.o | c++filt | grep -E "^0+([0-9a-f]+)\s+cbz.*\1$"
0000000000003700 cbz x12, 0x3700
inside of the function Object::copyArrayData. It appears that the inlined
protoHasArray method is causing this code to be generated.
This also happens when generating x86 code:
00000000000032b0 testq %rdi, %rdi
00000000000032b3 je 0x32b0
This doesn't happen with clang 3.6.2 or with a lower optimization level.
P.S.: Apologies for the giant input file. I couldn't find a way to reproduce
with a trivial example.</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>