-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Labels
clang-formatcrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]duplicateResolved as duplicateResolved as duplicate
Description
Hi, while working on my project I experienced clang-format crash.
The source file which caused the crash is here https://github.com/Bronek/functional/blob/crasher_clang_format/tests/pfn/expected.cpp (it does not compile cleanly, clang-format crashed while I was typing the unfinished last line)
More details:
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /usr/bin/clang-format -output-replacements-xml -style=file -fallback-style=LLVM -assume-filename=/home/LAN/bronek/gits/functional/tests/pfn/expected.cpp -offset=5845 -length=10
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.so.19.1 0x00007f8c751a93c6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 54
1 libLLVM.so.19.1 0x00007f8c751a7070 llvm::sys::RunSignalHandlers() + 80
2 libLLVM.so.19.1 0x00007f8c751a9a8b
3 libc.so.6 0x00007f8c73dd1050
4 libclang-cpp.so.19.1 0x00007f8c7f36eb08 clang::format::LeftRightQualifierAlignmentFixer::analyzeRight(clang::SourceManager const&, clang::format::AdditionalKeywords const&, clang::tooling::Replacements&, clang::format::FormatToken const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, clang::tok::TokenKind) + 1304
5 libclang-cpp.so.19.1 0x00007f8c7f3703f8 clang::format::LeftRightQualifierAlignmentFixer::fixQualifierAlignment(llvm::SmallVectorImpl<clang::format::AnnotatedLine*>&, clang::format::FormatTokenLexer&, clang::tooling::Replacements&) + 296
6 libclang-cpp.so.19.1 0x00007f8c7f370200 clang::format::LeftRightQualifierAlignmentFixer::analyze(clang::format::TokenAnnotator&, llvm::SmallVectorImpl<clang::format::AnnotatedLine*>&, clang::format::FormatTokenLexer&) + 112
7 libclang-cpp.so.19.1 0x00007f8c7f3794c9 clang::format::TokenAnalyzer::process(bool) + 1161
8 libclang-cpp.so.19.1 0x00007f8c7f370c3d
9 libclang-cpp.so.19.1 0x00007f8c7f340f25 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*) + 4165
10 libclang-cpp.so.19.1 0x00007f8c7f341da1 clang::format::reformat(clang::format::FormatStyle const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef, clang::format::FormattingAttemptStatus*) + 81
11 clang-format 0x000055f2aef3dfb1
12 clang-format 0x000055f2aef3b5dd
13 libc.so.6 0x00007f8c73dbc24a
14 libc.so.6 0x00007f8c73dbc305 __libc_start_main + 133
15 clang-format 0x000055f2aef38471
I originally experienced it with clang-format 19.1.7, installed from apt.llvm.org, details from the devcontainer:
root@a3d12c39e031 ~ # clang-format --version
Debian clang-format version 19.1.7 (++20250114103228+cd708029e0b2-1~exp1~20250114103334.78)
root@a3d12c39e031 ~ # sha256sum /usr/lib/llvm-19/bin/clang-format
2767d049a57a6b4cc20ec076de58b02928a2d75f5908e29716206b3f12aade6e /usr/lib/llvm-19/bin/clang-format
root@a3d12c39e031 ~ # dpkg -S /usr/lib/llvm-19/bin/clang-format
clang-format-19: /usr/lib/llvm-19/bin/clang-format
root@a3d12c39e031 ~ # dpkg -s clang-format-19
Package: clang-format-19
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 240
Maintainer: LLVM Packaging Team <[email protected]>
Architecture: amd64
Source: llvm-toolchain-19
Version: 1:19.1.7~++20250114103228+cd708029e0b2-1~exp1~20250114103334.78
Depends: libc6 (>= 2.34), libclang-cpp19 (>= 1:19.1.7~++20250114103228+cd708029e0b2), libgcc-s1 (>= 3.0), libllvm19 (= 1:19.1.7~++20250114103228+cd708029e0b2-1~exp1~20250114103334.78), libstdc++6 (>= 11), python3
I also reproduced it with clang-format 18.1.8 installed from clang-format-wheel for pre-commit
bronek@gdansk ~/gits/functional (git)-[crasher_clang_format] % clang-format -i tests/pfn/expected.cpp
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format -i tests/pfn/expected.cpp
#0 0x0000000000476af8 (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x476af8)
#1 0x00000000004748cc (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x4748cc)
#2 0x00007f343a4c41d0 (/usr/lib/libc.so.6+0x3d1d0)
#3 0x0000000000405cb0 (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x405cb0)
#4 0x00000000004d6843 (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x4d6843)
#5 0x00000000004d6928 (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x4d6928)
#6 0x00000000004ead73 (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x4ead73)
#7 0x00000000004d8907 (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x4d8907)
#8 0x00000000004d893d (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x4d893d)
#9 0x00000000004b6d7b (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x4b6d7b)
#10 0x00000000004b8b47 (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x4b8b47)
#11 0x000000000042503a (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x42503a)
#12 0x0000000000409905 (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x409905)
#13 0x00007f343a4ace08 __libc_start_call_main /usr/src/debug/glibc/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#14 0x00007f343a4acecc call_init /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:128:20
#15 0x00007f343a4acecc __libc_start_main /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:347:5
#16 0x000000000041c787 (/home/LAN/bronek/.venv/lib/python3.13/site-packages/clang_format/data/bin/clang-format+0x41c787)
bronek@gdansk ~/gits/functional (git)-[crasher_clang_format] % clang-format --version
clang-format version 18.1.8
bronek@gdansk ~/gits/functional (git)-[crasher_clang_format] % sha256sum `which clang-format`
002151abe3f506a5c97dad005df0e4608d12b39216ed320dee192af61c42a364 /home/LAN/bronek/.venv/bin/clang-format
Metadata
Metadata
Assignees
Labels
clang-formatcrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]duplicateResolved as duplicateResolved as duplicate