[llvm-bugs] [Bug 50663] New: [clang-format] Crash with Whitesmiths and labels in top-level block

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 10 14:34:29 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50663

            Bug ID: 50663
           Summary: [clang-format] Crash with Whitesmiths and labels in
                    top-level block
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: oliver.old at outlook.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 24941
  --> https://bugs.llvm.org/attachment.cgi?id=24941&action=edit
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 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.

[1] https://reviews.llvm.org/D94500

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210610/d8f1734c/attachment.html>


More information about the llvm-bugs mailing list