-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]
Description
Compiling the following C++ code (minimal reproducible example) with Clang:
#include <cstddef>
class Test {
public:
// The problem is the `const` qualifier. If it is removed, then the frontend does not crash.
void* operator new(size_t bytes) const { return nullptr; }
};
int main() {
new Test();
return 0;
}Gives the following stacktrace:
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++ -I/home/hgruniaux/CLionProjects/iris-cxx/inc -g -std=gnu++20 -fcolor-diagnostics -MD -MT CMakeFiles/iris_cxx.dir/src/main.cpp.o -MF CMakeFiles/iris_cxx.dir/src/main.cpp.o.d -o CMakeFiles/iris_cxx.dir/src/main.cpp.o -c /home/hgruniaux/CLionProjects/iris-cxx/src/main.cpp
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/home/hgruniaux/CLionProjects/iris-cxx/src/main.cpp'.
4. Running pass 'X86 Assembly Printer' on function '@_ZNK4TestnwEm'
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-16.so.1 0x00007f01193c975a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 58
1 libLLVM-16.so.1 0x00007f01193c7994 llvm::sys::RunSignalHandlers() + 84
2 libLLVM-16.so.1 0x00007f0119306494
3 libc.so.6 0x00007f0117c42910
4 libLLVM-16.so.1 0x00007f01195155f4 llvm::MDString::getString() const + 4
5 libLLVM-16.so.1 0x00007f0119c9429a llvm::DwarfUnit::updateAcceleratorTables(llvm::DIScope const*, llvm::DIType const*, llvm::DIE const&) + 74
6 libLLVM-16.so.1 0x00007f0119c94419 llvm::DwarfUnit::createTypeDIE(llvm::DIScope const*, llvm::DIE&, llvm::DIType const*) + 153
7 libLLVM-16.so.1 0x00007f0119c9558a llvm::DwarfUnit::constructSubprogramArguments(llvm::DIE&, llvm::DITypeRefArray) + 282
8 libLLVM-16.so.1 0x00007f0119c9724d llvm::DwarfUnit::applySubprogramAttributes(llvm::DISubprogram const*, llvm::DIE&, bool) + 1197
9 libLLVM-16.so.1 0x00007f0119c92e45 llvm::DwarfUnit::getOrCreateSubprogramDIE(llvm::DISubprogram const*, bool) + 293
10 libLLVM-16.so.1 0x00007f0119c936d6 llvm::DwarfUnit::constructTypeDIE(llvm::DIE&, llvm::DICompositeType const*) + 662
11 libLLVM-16.so.1 0x00007f0119c94503 llvm::DwarfUnit::createTypeDIE(llvm::DIScope const*, llvm::DIE&, llvm::DIType const*) + 387
12 libLLVM-16.so.1 0x00007f0119c92d65 llvm::DwarfUnit::getOrCreateSubprogramDIE(llvm::DISubprogram const*, bool) + 69
13 libLLVM-16.so.1 0x00007f0119c6737f llvm::DwarfCompileUnit::constructSubprogramScopeDIE(llvm::DISubprogram const*, llvm::LexicalScope*) + 79
14 libLLVM-16.so.1 0x00007f0119c780e1 llvm::DwarfDebug::endFunctionImpl(llvm::MachineFunction const*) + 929
15 libLLVM-16.so.1 0x00007f0119c5ae84 llvm::DebugHandlerBase::endFunction(llvm::MachineFunction const*) + 100
16 libLLVM-16.so.1 0x00007f0119c441e7 llvm::AsmPrinter::emitFunctionBody() + 11303
17 libLLVM-16.so.1 0x00007f011bd1fbca
18 libLLVM-16.so.1 0x00007f011975fd9b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 635
19 libLLVM-16.so.1 0x00007f011950536d llvm::FPPassManager::runOnFunction(llvm::Function&) + 653
20 libLLVM-16.so.1 0x00007f011950b143 llvm::FPPassManager::runOnModule(llvm::Module&) + 51
21 libLLVM-16.so.1 0x00007f0119505a25 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 965
22 libclang-cpp.so.16 0x00007f012170877b clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) + 3339
23 libclang-cpp.so.16 0x00007f0121a69f7f
24 libclang-cpp.so.16 0x00007f01207ddf32 clang::ParseAST(clang::Sema&, bool, bool) + 850
25 libclang-cpp.so.16 0x00007f012241d2a9 clang::FrontendAction::Execute() + 89
26 libclang-cpp.so.16 0x00007f0122398184 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 724
27 libclang-cpp.so.16 0x00007f0122496a64 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 660
28 clang++ 0x00005566ba773d86 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 2374
29 clang++ 0x00005566ba770e00
30 libclang-cpp.so.16 0x00007f0122070536
31 libLLVM-16.so.1 0x00007f0119306224 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 148
32 libclang-cpp.so.16 0x00007f012206fbe7 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const + 359
33 libclang-cpp.so.16 0x00007f012203ac86 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 854
34 libclang-cpp.so.16 0x00007f012203aeee clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 158
35 libclang-cpp.so.16 0x00007f012205572e clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 334
36 clang++ 0x00005566ba77058a clang_main(int, char**) + 11882
37 libc.so.6 0x00007f0117c280d0
38 libc.so.6 0x00007f0117c28189 __libc_start_main + 137
39 clang++ 0x00005566ba76d3a5 _start + 37
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Ubuntu clang version 16.0.6 (15)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
The used Clang version is 16.0.6. I have no tested if the bug is still there on more recent versions of Clang.
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]