Issue 71406
Summary Segmentation fault with a C file
Labels new issue
Assignees
Reporter briowireless
    Hi,

I get a segmentation fault when trying to run clang-format on a specific file.

- I installed clang-format-18 using `apt install`.
- I am running Debian 11 (bullseye)

Below is a stack dump:
```
Stack dump:
0.	Program arguments: clang-format -i -style=file app/ultrasound_task.c -Werror --ferror-limit=1
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM-18.so.1 0x00007eff75e089b6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 54
1  libLLVM-18.so.1    0x00007eff75e06960 llvm::sys::RunSignalHandlers() + 80
2  libLLVM-18.so.1    0x00007eff75e09080
3  libpthread.so.0 0x00007eff80911140
4  libclang-cpp.so.18 0x00007eff7fb9e603
5 libclang-cpp.so.18 0x00007eff7fb9e0b3 clang::format::WhitespaceManager::alignArrayInitializersLeftJustified(clang::format::WhitespaceManager::CellDescriptions&&) + 307
6  libclang-cpp.so.18 0x00007eff7fb9c8be clang::format::WhitespaceManager::alignArrayInitializers(unsigned int, unsigned int) + 110
7  libclang-cpp.so.18 0x00007eff7fb993a6 clang::format::WhitespaceManager::generateReplacements() + 390
8 libclang-cpp.so.18 0x00007eff7fb387d6
9  libclang-cpp.so.18 0x00007eff7fb6da36 clang::format::TokenAnalyzer::process(bool) + 1126
10 libclang-cpp.so.18 0x00007eff7fb48bbd
11 libclang-cpp.so.18 0x00007eff7fb30b14 clang::format::internal::reformat(clang::format::FormatStyle const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int, unsigned int, llvm::StringRef, clang::format::FormattingAttemptStatus*) + 2276
12 libclang-cpp.so.18 0x00007eff7fb32071 clang::format::reformat(clang::format::FormatStyle const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef, clang::format::FormattingAttemptStatus*) + 81
13 clang-format 0x0000561ac4091cff
14 clang-format       0x0000561ac4090794
15 libc.so.6          0x00007eff74be8d0a __libc_start_main + 234
16 clang-format       0x0000561ac408daaa
Segmentation fault
```

[ultrasound_task.txt](https://github.com/llvm/llvm-project/files/13268751/ultrasound_task.txt)
Attached is the file that caused the seg fault (I renamed it to txt, but it was originally a c file). Let me know if you need more debug information.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to