llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
26.83k stars 11.01k forks source link

Crash when building llvm19.0.0git 'llvm/lib/Demangle/Demangle.cpp' #87921

Open KneeCapStealer opened 3 months ago

KneeCapStealer commented 3 months ago

While trying to build llvm, the build process stopped and gave me the following message: PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.

Backtrace

Backtrace.txt

CMake commands

CXX=/usr/local/bin/clang++ CC=/usr/local/bin/clang cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lld;lldb;clang-tools-extra" -DLLVM_ENABLE_RUNTIMES=all -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_ENABLE_MODULES=ON -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="AArch64;AVR;RISCV;X86" -DLLVM_HOST_TRIPLE="x86_64-pc-linux-gnu" -DLLVM_TARGET_TRIPLE="x86_64-pc-linux-gnu" -DCMAKE_CXX_STANDARD=20 -DLLVM_USE_LINKER=lld -DLLVM_ENABLE_LIBCXX=ON --fresh

Environment

I am on ArchWSL from this site: https://wsldl-pg.github.io/ArchW-docs/How-to-Setup/ Linux Chris-PC 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 GNU/Linux

Files

cache folder download here (file too big for github): https://filebin.net/foy7l614ngndrwxy Demangle-686a3c-cpp-and-sh.zip

llvmbot commented 3 months ago

@llvm/issue-subscribers-clang-frontend

Author: Christoffer Hald Christensen (KneeCapStealer)

Very far from being an expert at this, I simply wanted the newest llvm. But the program crashed and asked me to send bug report. While trying to build llvm, the build process stopped and gave me the following message: `PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.` ## Backtrace ```Stack dump: 0. Program arguments: /usr/local/bin/clang++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/christoffer/llvm/llvm-trunk/build/lib/Demangle -I/home/christoffer/llvm/llvm-trunk/llvm/lib/Demangle -I/home/christoffer/llvm/llvm-trunk/build/include -I/home/christoffer/llvm/llvm-trunk/llvm/include -stdlib=libc++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -fmodules -fmodules-cache-path=/home/christoffer/llvm/llvm-trunk/build/module.cache -Xclang -fmodules-local-submodule-visibility -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++20 -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o -MF lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o.d -o lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o -c /home/christoffer/llvm/llvm-trunk/llvm/lib/Demangle/Demangle.cpp 1. /home/christoffer/llvm/llvm-trunk/llvm/lib/Demangle/Demangle.cpp:21:21: current parser token ';' 2. /home/christoffer/llvm/llvm-trunk/llvm/lib/Demangle/Demangle.cpp:20:58: parsing function body 'llvm::demangle' 3. /home/christoffer/llvm/llvm-trunk/llvm/lib/Demangle/Demangle.cpp:20:58: in compound statement ('{}') #0 0x0000563909bc327e llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/bin/clang+++0x304c27e) #1 0x0000563909bc0ffc llvm::sys::CleanupOnSignal(unsigned long) (/usr/local/bin/clang+++0x3049ffc) #2 0x0000563909af5878 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0 #3 0x00007f6dea1a9770 (/usr/lib/libc.so.6+0x3c770) #4 0x000056390a7ef393 clang::ASTReader::DecodeIdentifierInfo(unsigned int) (/usr/local/bin/clang+++0x3c78393) #5 0x000056390a7fd72c clang::ASTRecordReader::readNestedNameSpecifierLoc() (/usr/local/bin/clang+++0x3c8672c) #6 0x000056390a7fdb4e clang::TypeLocReader::VisitElaboratedTypeLoc(clang::ElaboratedTypeLoc) (/usr/local/bin/clang+++0x3c86b4e) #7 0x000056390a804e5e clang::ASTRecordReader::readTypeLoc(clang::TypeLoc, clang::SourceLocationSequence*) (/usr/local/bin/clang+++0x3c8de5e) #8 0x000056390a8452ba clang::ASTDeclReader::Visit(clang::Decl*) (/usr/local/bin/clang+++0x3cce2ba) #9 0x000056390a845ccc clang::ASTReader::ReadDeclRecord(unsigned int) (/usr/local/bin/clang+++0x3cceccc) #10 0x000056390a7d76c2 clang::ASTReader::GetDecl(unsigned int) (/usr/local/bin/clang+++0x3c606c2) #11 0x000056390a843296 clang::ASTDeclReader::VisitFunctionDecl(clang::FunctionDecl*) (/usr/local/bin/clang+++0x3ccc296) #12 0x000056390a845251 clang::ASTDeclReader::Visit(clang::Decl*) (/usr/local/bin/clang+++0x3cce251) #13 0x000056390a845ccc clang::ASTReader::ReadDeclRecord(unsigned int) (/usr/local/bin/clang+++0x3cceccc) #14 0x000056390a795853 clang::ASTReader::GetDecl(unsigned int) (.part.0) ASTReader.cpp:0:0 #15 0x000056390a7e77a5 clang::ASTReader::finishPendingActions() (/usr/local/bin/clang+++0x3c707a5) #16 0x000056390a7eed34 non-virtual thunk to clang::ASTReader::FinishedDeserializing() (/usr/local/bin/clang+++0x3c77d34) #17 0x000056390a845e45 clang::ASTReader::ReadDeclRecord(unsigned int) (/usr/local/bin/clang+++0x3ccee45) #18 0x000056390a7d33d2 non-virtual thunk to clang::ASTReader::GetExternalDecl(unsigned int) (/usr/local/bin/clang+++0x3c5c3d2) #19 0x000056390cd495d4 clang::RedeclarableTemplateDecl::loadLazySpecializationsImpl() const (/usr/local/bin/clang+++0x61d25d4) #20 0x000056390a78804b clang::ASTReader::CompleteRedeclChain(clang::Decl const*) (/usr/local/bin/clang+++0x3c1104b) #21 0x000056390d035a12 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/usr/local/bin/clang+++0x64bea12) #22 0x000056390d039369 (anonymous namespace)::EmptySubobjectMap::ComputeEmptySubobjectSizes() RecordLayoutBuilder.cpp:0:0 #23 0x000056390d035bc5 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/usr/local/bin/clang+++0x64bebc5) #24 0x000056390d039369 (anonymous namespace)::EmptySubobjectMap::ComputeEmptySubobjectSizes() RecordLayoutBuilder.cpp:0:0 #25 0x000056390d035bc5 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/usr/local/bin/clang+++0x64bebc5) #26 0x000056390d0394a1 (anonymous namespace)::EmptySubobjectMap::ComputeEmptySubobjectSizes() RecordLayoutBuilder.cpp:0:0 #27 0x000056390d035bc5 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/usr/local/bin/clang+++0x64bebc5) #28 0x000056390cba838a clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/usr/local/bin/clang+++0x603138a) #29 0x000056390cb921a2 clang::ASTContext::getTypeInfo(clang::Type const*) const (/usr/local/bin/clang+++0x601b1a2) #30 0x000056390cba89d5 clang::ASTContext::getTypeAlignInChars(clang::QualType) const (/usr/local/bin/clang+++0x60319d5) #31 0x000056390bef9087 clang::Sema::CheckArgAlignment(clang::SourceLocation, clang::NamedDecl*, llvm::StringRef, clang::QualType, clang::QualType) (/usr/local/bin/clang+++0x5382087) #32 0x000056390bf572a3 clang::Sema::CheckConstructorCall(clang::FunctionDecl*, clang::QualType, llvm::ArrayRef<clang::Expr const*>, clang::FunctionProtoType const*, clang::SourceLocation) (/usr/local/bin/clang+++0x53e02a3) #33 0x000056390c105210 clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*, clang::QualType, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, llvm::SmallVectorImpl<clang::Expr*>&, bool, bool) (/usr/local/bin/clang+++0x558e210) #34 0x000056390c409152 PerformConstructorInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation) SemaInit.cpp:0:0 #35 0x000056390c428d6b clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/usr/local/bin/clang+++0x58b1d6b) #36 0x000056390c077339 clang::Sema::ActOnUninitializedDecl(clang::Decl*) (/usr/local/bin/clang+++0x5500339) #37 0x000056390bd47a5d clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/usr/local/bin/clang+++0x51d0a5d) #38 0x000056390bd5c3c2 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/usr/local/bin/clang+++0x51e53c2) #39 0x000056390bd5fc17 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (/usr/local/bin/clang+++0x51e8c17) #40 0x000056390bd600f3 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/usr/local/bin/clang+++0x51e90f3) #41 0x000056390be03729 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/local/bin/clang+++0x528c729) #42 0x000056390be04ef2 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/local/bin/clang+++0x528def2) #43 0x000056390be05c91 clang::Parser::ParseCompoundStatementBody(bool) (/usr/local/bin/clang+++0x528ec91) #44 0x000056390be066ea clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/local/bin/clang+++0x528f6ea) #45 0x000056390bd1cbec clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/usr/local/bin/clang+++0x51a5bec) #46 0x000056390bd5c8f0 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/usr/local/bin/clang+++0x51e58f0) #47 0x000056390bd16641 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/local/bin/clang+++0x519f641) #48 0x000056390bd1728d clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/local/bin/clang+++0x51a028d) #49 0x000056390bd1e645 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/local/bin/clang+++0x51a7645) #50 0x000056390bd20025 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/local/bin/clang+++0x51a9025) #51 0x000056390bd10d5a clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/bin/clang+++0x5199d5a) #52 0x000056390a6b58b9 clang::FrontendAction::Execute() (/usr/local/bin/clang+++0x3b3e8b9) #53 0x000056390a63d9db clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/bin/clang+++0x3ac69db) #54 0x000056390a78227b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/bin/clang+++0x3c0b27b) #55 0x0000563907970cdc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/bin/clang+++0xdf9cdc) #56 0x000056390796acba ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0 #57 0x000056390a456fb9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0 #58 0x0000563909af5c93 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/local/bin/clang+++0x2f7ec93) #59 0x000056390a457391 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0 #60 0x000056390a41e3e6 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/local/bin/clang+++0x38a73e6) #61 0x000056390a41ee9d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/local/bin/clang+++0x38a7e9d) #62 0x000056390a431e5c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/local/bin/clang+++0x38bae5c) #63 0x000056390796e675 clang_main(int, char**, llvm::ToolContext const&) (/usr/local/bin/clang+++0xdf7675) #64 0x0000563907868ca6 main (/usr/local/bin/clang+++0xcf1ca6) #65 0x00007f6dea192cd0 (/usr/lib/libc.so.6+0x25cd0) #66 0x00007f6dea192d8a __libc_start_main (/usr/lib/libc.so.6+0x25d8a) #67 0x000056390796aad5 _start (/usr/local/bin/clang+++0xdf3ad5) clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation) clang version 19.0.0git (https://github.com/llvm/llvm-project.git bd9486b4ec7dc24f73f32474fa38b522a7cce085) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin clang++: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang++: note: diagnostic msg: /tmp/Demangle-686a3c.cpp clang++: note: diagnostic msg: /tmp/Demangle-686a3c.cache clang++: note: diagnostic msg: /tmp/Demangle-686a3c.sh clang++: note: diagnostic msg: ******************** ninja: build stopped: subcommand failed ``` ## CMake commands - Generate: `CXX=/usr/local/bin/clang++ CC=/usr/local/bin/clang cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lld;lldb;clang-tools-extra" -DLLVM_ENABLE_RUNTIMES=all -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_ENABLE_MODULES=ON -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="AArch64;AVR;RISCV;X86" -DLLVM_HOST_TRIPLE="x86_64-pc-linux-gnu" -DLLVM_TARGET_TRIPLE="x86_64-pc-linux-gnu" -DCMAKE_CXX_STANDARD=20 -DLLVM_USE_LINKER=lld -DLLVM_ENABLE_LIBCXX=ON --fresh` - Build: `cmake --build build` ## Environment I am on ArchWSL from this site: https://wsldl-pg.github.io/ArchW-docs/How-to-Setup/ *uname -a out:* `Linux Chris-PC 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 GNU/Linux` The llvm version I used to build with was llvm 19.0.0git built via gcc (13.2.1 20230801) installed via pacman. That llvm version was build like so: - Generate: `cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lld;lldb;clang-tools-extra" -DLLVM_ENABLE_RUNTIMES=all -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_ENABLE_MODULES=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="AArch64;AMDGPU;ARM;AVR;RISCV;WebAssembly;X86;XCore" -DLLVM_HOST_TRIPLE="x86_64-pc-linux-gnu" -DLLVM_TARGET_TRIPLE="x86_64-pc-linux-gnu"` - Build: `ninja -C build` ## Files cache folder download here (folder was too huge): https://filebin.net/foy7l614ngndrwxy [Demangle-686a3c-cpp-and-sh.zip](https://github.com/llvm/llvm-project/files/14897220/Demangle-686a3c-cpp-and-sh.zip)