<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 - compile-time explosion (infinite loop) at -O2 on clang trunk version"
href="https://bugs.llvm.org/show_bug.cgi?id=51922">51922</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>compile-time explosion (infinite loop) at -O2 on clang trunk version
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>haoxintu@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Hi all.
I guess there are some issues in loop optimization but I am not sure what
exactly it is, so please feel free to change the title to a more appropriate
one.
$cat small.c
#include <stdint.h>
int c_0 = 0x0;
int i_2 = 0x02604788;
int c_4 = 0x60;
int us_7 = 0x0A34;
uint8_t uc_8 = 0x67;
int s_10 = 0x0;
int64_t li_14 = 0x1E342489BD39A630;
int8_t func_5() {
uint16_t us_20 = 0x2D7F;
if (0)
for (us_20 = 15; us_20 <= 31; us_20 += 1)
;
uc_8 = -10;
for (; uc_8 > 100; uc_8 += 3) {
i_2 = 5;
do {
s_10 = -5;
while (s_10++) {
li_14 = -6;
while (li_14 < 100) {
li_14 += 2;
if ((0x0 != c_4)) {
c_0 = 6;
for (; c_0 > 2; c_0 -= 5)
do
do
do
return 0;
while (us_7 < 100);
while (c_4 < 100);
while (0);
}
}
}
} while (i_2--);
}
return 0;
}
$clang -c -O2 small.c
//endless compiling
$time clang -c -O3 small.c
real 0m0.258s
user 0m0.056s
sys 0m0.055s
$clang -v
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
92904cc68fbc1d000387b30accc8b05b3fe95daa)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/haoxin-data/compilers/llvm-project/build/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
Reproduced in Godbolt: <a href="https://godbolt.org/z/xoKfjYE1s">https://godbolt.org/z/xoKfjYE1s</a>
Thanks,
Haoxin</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>