Crash in `Sema::CppLookupName`
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```console
[94/2467] Building CXX object /mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-build/CMakeFiles/spdlog.dir/src/sinks/rotating_file_sink.cpp.obj
FAILED: [code=1] /mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-build/CMakeFiles/spdlog.dir/src/sinks/rotating_file_sink.cpp.obj
/usr/bin/clang-cl --target=x86_64-w64-windows-msvc /nologo -TP -DSPDLOG_FWRITE_UNLOCKED -I/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-src/include -imsvc/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/fmt-src/include -std:c++17 -MD -clang:-Wno-c++11-narrowing -clang:-Wno-microsoft-cast -clang:-Wno-microsoft-enum-value -clang:-Wno-invalid-offsetof -clang:-fms-extensions -clang:-fms-compatibility -clang:-fdelayed-template-parsing -clang:-march=native /EHsc -clang:-MD -clang:-MT/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-build/CMakeFiles/spdlog.dir/src/sinks/rotating_file_sink.cpp.obj -clang:-MF/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-build/CMakeFiles/spdlog.dir/src/sinks/rotating_file_sink.cpp.obj.d /Fo/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-build/CMakeFiles/spdlog.dir/src/sinks/rotating_file_sink.cpp.obj /Fd/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-build/CMakeFiles/spdlog.dir/spdlog.pdb -c -- /mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-src/src/sinks/rotating_file_sink.cpp
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /usr/bin/clang-cl --target=x86_64-w64-windows-msvc /nologo -TP -DSPDLOG_FWRITE_UNLOCKED -I/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-src/include -imsvc/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/fmt-src/include -std:c++17 -MD -clang:-Wno-c++11-narrowing -clang:-Wno-microsoft-cast -clang:-Wno-microsoft-enum-value -clang:-Wno-invalid-offsetof -clang:-fms-extensions -clang:-fms-compatibility -clang:-fdelayed-template-parsing -clang:-march=native /EHsc -clang:-MD -clang:-MT/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-build/CMakeFiles/spdlog.dir/src/sinks/rotating_file_sink.cpp.obj -clang:-MF/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-build/CMakeFiles/spdlog.dir/src/sinks/rotating_file_sink.cpp.obj.d /Fo/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-build/CMakeFiles/spdlog.dir/src/sinks/rotating_file_sink.cpp.obj /Fd/mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-build/CMakeFiles/spdlog.dir/spdlog.pdb -c -- /mnt/hdd/Projects/xray-monolith/src/build_msvc/_deps/spdlog-src/src/sinks/rotating_file_sink.cpp
1. /mnt/hdd/msvc_wine/vc/tools/msvc/14.51.36231/include/xutility:589:16: current parser token '__std_mismatch_1'
2. /mnt/hdd/msvc_wine/vc/tools/msvc/14.51.36231/include/xutility:581:113: parsing function body 'std::_Mismatch_vectorized'
3. /mnt/hdd/msvc_wine/vc/tools/msvc/14.51.36231/include/xutility:581:113: in compound statement ('{}')
4. /mnt/hdd/msvc_wine/vc/tools/msvc/14.51.36231/include/xutility:588:12: in compound statement ('{}')
#0 0x00007f49aa19143a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.22.1+0x839143a)
#1 0x00007f49aa1911cb llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/libLLVM.so.22.1+0x83911cb)
#2 0x00007f49aa146b40 (/usr/lib/libLLVM.so.22.1+0x8346b40)
#3 0x00007f49aa146d5d (/usr/lib/libLLVM.so.22.1+0x8346d5d)
#4 0x00007f49a16448f0 (/usr/lib/libc.so.6+0x448f0)
#5 0x00007f49ac06acf9 (/usr/lib/libclang-cpp.so.22.1+0x126acf9)
#6 0x00007f49ac068807 clang::Sema::CppLookupName(clang::LookupResult&, clang::Scope*) (/usr/lib/libclang-cpp.so.22.1+0x1268807)
#7 0x00007f49abfd4540 clang::Sema::LookupName(clang::LookupResult&, clang::Scope*, bool, bool) (/usr/lib/libclang-cpp.so.22.1+0x11d4540)
#8 0x00007f49abfd1c99 clang::Sema::getTypeName(clang::IdentifierInfo const&, clang::SourceLocation, clang::Scope*, clang::CXXScopeSpec*, bool, bool, clang::OpaquePtr, bool, bool, bool, clang::ImplicitTypenameContext, clang::IdentifierInfo**) (/usr/lib/libclang-cpp.so.22.1+0x11d1c99)
#9 0x00007f49abfd1009 clang::Parser::TryAnnotateTypeOrScopeToken(clang::ImplicitTypenameContext) (/usr/lib/libclang-cpp.so.22.1+0x11d1009)
#10 0x00007f49ac0a29df clang::Parser::ParseCastExpression(clang::CastParseKind, bool, bool&, clang::TypoCorrectionTypeBehavior, bool, bool*) (/usr/lib/libclang-cpp.so.22.1+0x12a29df)
#11 0x00007f49ac099bf1 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::LabelDecl*) (/usr/lib/libclang-cpp.so.22.1+0x1299bf1)
#12 0x00007f49ac095d2c clang::Parser::ParseCompoundStatementBody(bool) (/usr/lib/libclang-cpp.so.22.1+0x1295d2c)
#13 0x00007f49ac09a478 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::LabelDecl*) (/usr/lib/libclang-cpp.so.22.1+0x129a478)
#14 0x00007f49ac0929b7 clang::Parser::ParseIfStatement(clang::SourceLocation*) (/usr/lib/libclang-cpp.so.22.1+0x12929b7)
#15 0x00007f49ac09a2ab clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::LabelDecl*) (/usr/lib/libclang-cpp.so.22.1+0x129a2ab)
#16 0x00007f49ac0929b7 clang::Parser::ParseIfStatement(clang::SourceLocation*) (/usr/lib/libclang-cpp.so.22.1+0x12929b7)
#17 0x00007f49ac09a2ab clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::LabelDecl*) (/usr/lib/libclang-cpp.so.22.1+0x129a2ab)
#18 0x00007f49ac0929b7 clang::Parser::ParseIfStatement(clang::SourceLocation*) (/usr/lib/libclang-cpp.so.22.1+0x12929b7)
#19 0x00007f49ac09a2ab clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::LabelDecl*) (/usr/lib/libclang-cpp.so.22.1+0x129a2ab)
#20 0x00007f49ac097164 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/lib/libclang-cpp.so.22.1+0x1297164)
#21 0x00007f49ac8e7bff clang::Parser::ParseLateTemplatedFuncDef(clang::LateParsedTemplate&) (/usr/lib/libclang-cpp.so.22.1+0x1ae7bff)
#22 0x00007f49ad48736f clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/lib/libclang-cpp.so.22.1+0x268736f)
#23 0x00007f49ac397e94 clang::Sema::ActOnEndOfTranslationUnit() (/usr/lib/libclang-cpp.so.22.1+0x1597e94)
#24 0x00007f49abfa4b41 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.22.1+0x11a4b41)
#25 0x00007f49ac287dfe clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.22.1+0x1487dfe)
#26 0x00007f49ac28758a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.22.1+0x148758a)
#27 0x000055af8a68e280 cc1_main(llvm::ArrayRef, char const*, void*) (/usr/bin/clang-cl+0x11280)
#28 0x000055af8a68d679 (/usr/bin/clang-cl+0x10679)
#29 0x000055af8a68d556 (/usr/bin/clang-cl+0x10556)
#30 0x00007f49ad96721d (/usr/lib/libclang-cpp.so.22.1+0x2b6721d)
#31 0x00007f49aa146ada llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/usr/lib/libLLVM.so.22.1+0x8346ada)
#32 0x00007f49ac585bb2 clang::driver::CC1Command::Execute(llvm::ArrayRef>, std::__cxx11::basic_string, std::allocator>*, bool*) const (/usr/lib/libclang-cpp.so.22.1+0x1785bb2)
#33 0x00007f49ac46e4ff clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/libclang-cpp.so.22.1+0x166e4ff)
#34 0x00007f49ac46de92 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/usr/lib/libclang-cpp.so.22.1+0x166de92)
#35 0x000055af8a68c0f9 clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-cl+0xf0f9)
#36 0x000055af8a68b54b main (/usr/bin/clang-cl+0xe54b)
#37 0x00007f49a1627c8e (/usr/lib/libc.so.6+0x27c8e)
#38 0x00007f49a1627dcb __libc_start_main (/usr/lib/libc.so.6+0x27dcb)
#39 0x000055af8a6911d5 _start (/usr/bin/clang-cl+0x141d5)
clang-cl: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 22.1.8
Target: x86_64-w64-windows-msvc
Thread model: posix
InstalledDir: /usr/bin
clang-cl: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-cl: note: diagnostic msg: /tmp/rotating_file_sink-8c23a7.cpp
clang-cl: note: diagnostic msg: /tmp/rotating_file_sink-8c23a7.sh
clang-cl: note: diagnostic msg:
********************
```
[rotating_file_sink-8c23a7.cpp](https://github.com/user-attachments/files/30830773/rotating_file_sink-8c23a7.cpp)
[rotating_file_sink-8c23a7.sh](https://github.com/user-attachments/files/30830772/rotating_file_sink-8c23a7.sh)
Contributor guide
Research direction
Start by running rotating_file_sink-8c23a7.sh against the attached rotating_file_sink-8c23a7.cpp and inspect the crash in clang::Sema::CppLookupName while parsing the MSVC xutility header. Compare the result with the reported clang-cl 22.1.8 invocation; done means the supplied reproducer no longer crashes the compiler.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100