<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 - Stack overflow due to deep-level calls brought by deep-level child nodes during CodeGen."
href="https://bugs.llvm.org/show_bug.cgi?id=51990">51990</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Stack overflow due to deep-level calls brought by deep-level child nodes during CodeGen.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>enhancement
</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>liuke.gehry@bytedance.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>When CodeGen processes AST nodes, there are many closed-loop calls, like
A->B->C->A->D->..., and the stack frame rollback is performed when the last
child node is processed. This will accumulate stack frames as the depth of the
child node increases. Finally, the stack overflows.
Here is a segmentation fault in the clang++ frontend. My system is Debian10,
x86-64. The version of clang++ is version 11.0.1
*****************
$ ulimit -s
8192
$ cat demo.cpp
#include <string>
const std::string str = "str";
const std::string A = "=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "="
"=" + str + "=" + str + "=" + str + "=" + str + "=";
$ clang++ -c demo.cpp
Segmentation fault (core dumped)
*****************</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>