llvm / llvm-project

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

Crash in LinkageComputer::getLVForDecl #50953

Open b18b4cc9-5981-4825-a055-d10b6491b13c opened 2 years ago

b18b4cc9-5981-4825-a055-d10b6491b13c commented 2 years ago
Bugzilla Link 51611
Version trunk
OS MacOS X
CC @zygoloid

Extended Description

Clang keeps crashing and told me to file a bug report. I am using emscripten and c++ modules and was trying to compile some of the code from this repository: https://github.com/justinhj/astar-algorithm-cpp

I am unfamiliar with the inner workings of LLVM, but I am happy to compile a debug build or something if it helps.

clang version 14.0.0 (https://github.com/llvm/llvm-project 78e87970af888bbbd5652c31f3a8454e8e9dd5b8)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Users/joeleinbinder/emsdk/upstream/bin
0.  Program arguments: /Users/joeleinbinder/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=27 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/Users/joeleinbinder/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -O3 -g -std=c++2a -I/Users/joeleinbinder/joel-cpp-magic/objc -fcolor-diagnostics -Wno-nullability-completeness -Wno-objc-property-no-attribute -fobjc-abi-version=2 -fmodules -fbuiltin-module-map -fimplicit-modules -fimplicit-module-maps -fmodule-file=pathfinding=/Users/joeleinbinder/joel-cpp-magic/cache/Users/joeleinbinder/joelserver/pathfinding.pcm /Users/joeleinbinder/joel-cpp-magic/cache/Users/joeleinbinder/RTS/src/pathfinding.cpp.emx.cpp -c
1.  <eof> parser at end of file
2.  Per-file LLVM IR generation
3.  /Users/joeleinbinder/RTS/src/pathfinding.cpp:130:12: Generating code for declaration 'search'
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.dylib            0x00000001033519e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  libLLVM.dylib            0x0000000103350824 llvm::sys::RunSignalHandlers() + 112
2  libLLVM.dylib            0x0000000103350eb4 llvm::sys::CleanupOnSignal(unsigned long) + 232
3  libLLVM.dylib            0x0000000103281d00 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) + 128
4  libLLVM.dylib            0x0000000103281f2c CrashRecoverySignalHandler(int) + 124
5  libsystem_platform.dylib 0x000000018a1fec44 _sigtramp + 56
6  libsystem_pthread.dylib  0x000000018a1b343c pthread_kill + 292
7  libsystem_c.dylib        0x000000018a0fb454 abort + 124
8  libsystem_c.dylib        0x000000018a0fa8d4 err + 0
9  libclang-cpp.dylib       0x0000000106bac464 clang::LinkageComputer::getLVForDecl(clang::NamedDecl const*, clang::LVComputationKind) + 672
10 libclang-cpp.dylib       0x0000000106baf0d8 clang::NamedDecl::getLinkageAndVisibility() const + 188
11 libclang-cpp.dylib       0x0000000107b42cd0 clang::CodeGen::CodeGenModule::SetFunctionAttributes(clang::GlobalDecl, llvm::Function*, bool, bool) + 432
12 libclang-cpp.dylib       0x0000000107b46c6c clang::CodeGen::CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef, llvm::Type*, clang::GlobalDecl, bool, bool, bool, llvm::AttributeList, clang::CodeGen::ForDefinition_t) + 1536
13 libclang-cpp.dylib       0x0000000107927308 clang::CodeGen::CodeGenModule::getAddrAndTypeOfCXXStructor(clang::GlobalDecl, clang::CodeGen::CGFunctionInfo const*, llvm::FunctionType*, bool, clang::CodeGen::ForDefinition_t) + 336
14 libclang-cpp.dylib       0x000000010794bf08 clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(clang::CXXConstructorDecl const*, clang::CXXCtorType, bool, bool, clang::CodeGen::Address, clang::CodeGen::CallArgList&, clang::CodeGen::AggValueSlot::Overlap_t, clang::SourceLocation, bool) + 1024
15 libclang-cpp.dylib       0x000000010794b768 clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(clang::CXXConstructorDecl const*, clang::CXXCtorType, bool, bool, clang::CodeGen::AggValueSlot, clang::CXXConstructExpr const*) + 752
16 libclang-cpp.dylib       0x00000001079c63b0 clang::CodeGen::CodeGenFunction::EmitCXXConstructExpr(clang::CXXConstructExpr const*, clang::CodeGen::AggValueSlot) + 1756
17 libclang-cpp.dylib       0x00000001079bcd58 (anonymous namespace)::AggExprEmitter::VisitCXXConstructExpr(clang::CXXConstructExpr const*) + 216
18 libclang-cpp.dylib       0x00000001079b961c clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) + 548
19 libclang-cpp.dylib       0x0000000107986778 clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 644
20 libclang-cpp.dylib       0x0000000107983d64 clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) + 1344
21 libclang-cpp.dylib       0x00000001079800b0 clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) + 304
22 libclang-cpp.dylib       0x000000010797fc94 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) + 376
23 libclang-cpp.dylib       0x0000000107ad8a40 clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 156
24 libclang-cpp.dylib       0x0000000107ad0e28 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) + 504
25 libclang-cpp.dylib       0x0000000107ad04b8 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) + 88
26 libclang-cpp.dylib       0x0000000107ad9748 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 184
27 libclang-cpp.dylib       0x0000000107b2eab4 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) + 156
28 libclang-cpp.dylib       0x0000000107b2f5ac clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1152
29 libclang-cpp.dylib       0x0000000107b4b0bc clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 440
30 libclang-cpp.dylib       0x0000000107b44648 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 468
31 libclang-cpp.dylib       0x0000000107b3a224 clang::CodeGen::CodeGenModule::EmitDeferred() + 772
32 libclang-cpp.dylib       0x0000000107b38c74 clang::CodeGen::CodeGenModule::Release() + 60
33 libclang-cpp.dylib       0x0000000107be5e68 (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) + 80
34 libclang-cpp.dylib       0x0000000107b23d64 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 180
35 libclang-cpp.dylib       0x000000010691c818 clang::ParseAST(clang::Sema&, bool, bool) + 504
36 libclang-cpp.dylib       0x0000000108056134 clang::FrontendAction::Execute() + 112
37 libclang-cpp.dylib       0x0000000107febb3c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 832
38 libclang-cpp.dylib       0x00000001080cf018 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1156
39 clang++                  0x0000000102f8f9f4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1304
40 clang++                  0x0000000102f8de84 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) + 1016
41 libclang-cpp.dylib       0x0000000107d37e1c void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const::$_1>(long) + 28
42 libLLVM.dylib            0x0000000103281ba8 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 212
43 libclang-cpp.dylib       0x0000000107d3786c clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const + 232
44 libclang-cpp.dylib       0x0000000107d0e7b8 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const + 504
45 libclang-cpp.dylib       0x0000000107d0eb58 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) const + 112
46 libclang-cpp.dylib       0x0000000107d21d44 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) + 224
47 clang++                  0x0000000102f8d578 main + 9900
48 libdyld.dylib            0x000000018a1d1430 start + 4
clang-13: error: clang frontend command failed with exit code 134 (use -v to see invocation)
llvmbot commented 9 months ago

@llvm/issue-subscribers-clang-frontend