<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-format] Crash with Whitesmiths and labels in top-level block"
href="https://bugs.llvm.org/show_bug.cgi?id=50663">50663</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[clang-format] Crash with Whitesmiths and labels in top-level block
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</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>Formatter
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>oliver.old@outlook.com
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24941" name="attach_24941" title="Zipped goto.cpp and switch.cpp files">attachment 24941</a> <a href="attachment.cgi?id=24941&action=edit" title="Zipped goto.cpp and switch.cpp files">[details]</a></span>
Zipped goto.cpp and switch.cpp files
Formatting a file with a label within a top-level block causes clang-format to
hang for an extended period of time and use a lot of memory. It then proceeds
to crash:
PS C:\Users\olive\clang-format-repro> clang-format.exe
--style='{BreakBeforeBraces: Whitesmiths}' goto.cpp
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0. Program arguments: "C:\\Program Files\\LLVM\\bin\\clang-format.exe"
"--style={BreakBeforeBraces: Whitesmiths}" goto.cpp
PS C:\Users\olive\clang-format-repro> cat goto.cpp
int main() {
test:
return 0;
}
No actual backtrace is printed.
I have prepared test cases with both a simple function and a switch statement
and both lead to a crash.
My suspicion is that this was caused by the patch that tried to fix case labels
with Whitesmiths [1]. This bug does not occur with version 11.0 of
clang-format.
[1] <a href="https://reviews.llvm.org/D94500">https://reviews.llvm.org/D94500</a></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>