-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Description
Bugzilla Link | 50663 |
Resolution | FIXED |
Resolved on | Jun 16, 2021 00:04 |
Version | 12.0 |
OS | All |
Blocks | #48661 |
Attachments | Zipped goto.cpp and switch.cpp files |
CC | @mydeveloperday,@oold,@tstellar |
Fixed by commit(s) | f7f9f94 c7d7ace |
Extended Description
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 https://bugs.llvm.org/ 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.