<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 - clang memory hog with "LLVM ERROR: out of memory ""
href="https://bugs.llvm.org/show_bug.cgi?id=50352">50352</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang memory hog with "LLVM ERROR: out of memory "
</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.
The following simple valid C program makes clang eat too much memory at
compile-time. This issue exists on Clang-12 onwards versions.
$cat small.c
#include <stdint.h>
int a, b, c;
void d() {
int16_t e = 2;
int16_t *f = e;
for (*f = 20; *f; *f += 1)
for (a = 5; a <= 51; a++)
for (c = 3; c <= 83; c++)
for (b = 8; b <= 85; b++) {
static g = 2;
int64_t *i = g;
*i *= 3;
}
}
void l() {
uint16_t j;
for (j = 27; j <= 33; j++)
d();
}
void k() { l(); }
$ulimit -v 4096000 ; time clang -w -g -O3 small.c
LLVM ERROR: out of memory
Allocation failed
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments:
/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build/bin/clang-13
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj --mrelax-relocations
-disable-free -main-file-name small.c -mrelocation-model static
-mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -tune-cpu generic -debug-info-kind=limited
-dwarf-version=4 -debugger-tuning=gdb
-fcoverage-compilation-dir=/home/haoxin/haoxin-data/dut-research/covsmith-test/test-0505
-resource-dir
/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build/lib/clang/13.0.0
-c-isystem /usr/local/include/csmith-2.3.0/ -internal-isystem
/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build/lib/clang/13.0.0/include
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-w
-fdebug-compilation-dir=/home/haoxin/haoxin-data/dut-research/covsmith-test/test-0505
-ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops
-vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/small-9a7482.o
-x c small.c
1. <eof> parser at end of file
2. Optimizer
LLVM ERROR: out of memory
Allocation failed
clang-13: error: unable to execute command: Aborted (core dumped)
clang-13: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 13.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
ed339111bff690c6ba87d5e25c50bcad6793a309)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/haoxin/haoxin-data/dut-research/compilers/llvm-project/build/bin
clang-13: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/small-d7840e.c
clang-13: note: diagnostic msg: /tmp/small-d7840e.sh
clang-13: note: diagnostic msg:
********************
real 0m28.562s
user 0m26.230s
sys 0m2.224s
Reproduced in Godbolt: <a href="https://godbolt.org/z/Ke5Wx4PTe">https://godbolt.org/z/Ke5Wx4PTe</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>