Open Endilll opened 4 days ago
This came up during reduction of https://github.com/llvm/llvm-project/issues/96623. Code (https://godbolt.org/z/doefrKzeh):
struct BasicPersistent { BasicPersistent(const char * = __builtin_FUNCTION()); }; template <typename> decltype(BasicPersistent{}) construct_at(int) { return {}; } template <typename> static void construct() { construct_at<int>(0); } void AddObjectToUpArray() { construct<int>(); }
Clang 19.0 crash:
clang++: /root/llvm-project/clang/lib/CodeGen/CGExpr.cpp:5815: clang::CodeGen::RValue clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, const clang::CodeGen::CGCallee&, const clang::CallExpr*, clang::CodeGen::ReturnValueSlot, llvm::Value*): Assertion `CalleeType->isFunctionPointerType() && "Call must have function pointer type!"' failed. 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: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++11 <source> 1. <eof> parser at end of file 2. Per-file LLVM IR generation 3. <source>:11:13: Generating code for declaration 'construct' #0 0x0000000003a385c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a385c8) #1 0x0000000003a362bc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a362bc) #2 0x0000000003980688 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0 #3 0x00007e3710842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #4 0x00007e37108969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc) #5 0x00007e3710842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #6 0x00007e37108287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #7 0x00007e371082871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b) #8 0x00007e3710839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96) #9 0x00000000041b97f8 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41b97f8) #10 0x00000000041bb924 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41bb924) #11 0x0000000004208fe1 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0 #12 0x00000000041ffdb0 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0 #13 0x0000000004205b4c clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4205b4c) #14 0x00000000041946de clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41946de) #15 0x00000000041b6ead clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x41b6ead) #16 0x0000000003d93c65 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d93c65) #17 0x0000000003d9b8ac clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d9b8ac) #18 0x0000000003dff026 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3dff026) #19 0x0000000003e138dd clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e138dd) #20 0x0000000003e73352 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e73352) #21 0x0000000003e6e315 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e6e315) #22 0x0000000003e79a7d clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e79a7d) #23 0x0000000003e7c473 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3e7c473) #24 0x000000000432842e (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0 #25 0x0000000004326075 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4326075) #26 0x00000000063bef8c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63bef8c) #27 0x0000000004326808 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4326808) #28 0x00000000045ad759 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45ad759) #29 0x000000000453336e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x453336e) #30 0x0000000004695bae clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4695bae) #31 0x0000000000c710c5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc710c5) #32 0x0000000000c6a2ea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0 #33 0x0000000004369f39 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 #34 0x0000000003980b34 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3980b34) #35 0x000000000436a52f 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 #36 0x000000000432ffc5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x432ffc5) #37 0x0000000004330a2d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4330a2d) #38 0x0000000004338435 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4338435) #39 0x0000000000c6e495 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc6e495) #40 0x0000000000b46364 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb46364) #41 0x00007e3710829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #42 0x00007e3710829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #43 0x0000000000c69d9e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc69d9e) clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
@llvm/issue-subscribers-c-11
Author: Vlad Serebrennikov (Endilll)
@llvm/issue-subscribers-clang-codegen
This came up during reduction of https://github.com/llvm/llvm-project/issues/96623. Code (https://godbolt.org/z/doefrKzeh):
Clang 19.0 crash: