-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[C++][Modules] Assertion failure undeduced type in IR-generation #120277
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
clang:modules
C++20 modules and Clang Header Modules
crash
Prefer [crash-on-valid] or [crash-on-invalid]
Comments
This looks suspiciously similar to #60085 |
@llvm/issue-subscribers-clang-modules Author: David Stone (davidstone)
Given the following valid translation units:
export module a;
export template<int>
struct a {
static auto f() {
}
}; export module b;
import a;
void b() {
a<0> t;
} export module c;
import a;
void c() {
a<0>::f();
} export module d;
import a;
import b;
import c;
struct d {
static void g() {
a<0>::f();
a<1>::f();
}
}; clang crashes with /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 -MD -MT CMakeFiles/foo.dir/d.cpp.o -MF CMakeFiles/foo.dir/d.cpp.o.d @<!-- -->CMakeFiles/foo.dir/d.cpp.o.modmap -o CMakeFiles/foo.dir/d.cpp.o -c /app/d.cpp
undeduced type in IR-generation
UNREACHABLE executed at /root/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:266!
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-20241217/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -clear-ast-before-backend -main-file-name d.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/app/build -fcoverage-compilation-dir=/app/build -resource-dir /opt/compiler-explorer/clang-assertions-trunk-20241217/lib/clang/20 -std=c++20 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules -fmodule-file=a=CMakeFiles/foo.dir/a.pcm -fmodule-file=b=CMakeFiles/foo.dir/b.pcm -fmodule-file=c=CMakeFiles/foo.dir/c.pcm -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/foo.dir/d.cpp.o -x pcm CMakeFiles/foo.dir/d.pcm
1. <eof> parser at end of file
2. /app/d.cpp:8:14: LLVM IR generation of declaration 'd::g'
3. /app/d.cpp:8:14: Generating code for declaration 'd::g'
#<!-- -->0 0x0000000003c58b18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x3c58b18)
#<!-- -->1 0x0000000003c5651c SignalHandler(int) Signals.cpp:0:0
#<!-- -->2 0x00007c2ac3c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#<!-- -->3 0x00007c2ac3c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#<!-- -->4 0x00007c2ac3c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#<!-- -->5 0x00007c2ac3c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#<!-- -->6 0x0000000003baf6ea (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x3baf6ea)
#<!-- -->7 0x000000000403386a clang::CodeGen::CodeGenFunction::getEvaluationKind(clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x403386a)
#<!-- -->8 0x00000000041b6ccf clang::CodeGen::isAggregateTypeForABI(clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x41b6ccf)
#<!-- -->9 0x000000000419cd36 (anonymous namespace)::X86_64ABIInfo::getIndirectReturnResult(clang::QualType) const X86.cpp:0:0
#<!-- -->10 0x00000000041a698b (anonymous namespace)::X86_64ABIInfo::computeInfo(clang::CodeGen::CGFunctionInfo&) const X86.cpp:0:0
#<!-- -->11 0x00000000043b42d1 clang::CodeGen::CodeGenTypes::arrangeLLVMFunctionInfo(clang::CanQual<clang::Type>, clang::CodeGen::FnInfoOpts, llvm::ArrayRef<clang::CanQual<clang::Type>>, clang::FunctionType::ExtInfo, llvm::ArrayRef<clang::FunctionType::ExtParameterInfo>, clang::CodeGen::RequiredArgs) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x43b42d1)
#<!-- -->12 0x00000000043b6739 arrangeLLVMFunctionInfo(clang::CodeGen::CodeGenTypes&, bool, llvm::SmallVectorImpl<clang::CanQual<clang::Type>>&, clang::CanQual<clang::FunctionProtoType>) CGCall.cpp:0:0
#<!-- -->13 0x00000000043b6b3f clang::CodeGen::CodeGenTypes::arrangeFreeFunctionType(clang::CanQual<clang::FunctionProtoType>) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x43b6b3f)
#<!-- -->14 0x00000000041008f0 clang::CodeGen::CodeGenTypes::ConvertFunctionTypeInternal(clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x41008f0)
#<!-- -->15 0x00000000041010e7 clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x41010e7)
#<!-- -->16 0x00000000040af678 clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl, llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x40af678)
#<!-- -->17 0x000000000443aa3e clang::CodeGen::CodeGenModule::getRawFunctionPointer(clang::GlobalDecl, llvm::Type*) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x443aa3e)
#<!-- -->18 0x0000000004446d74 EmitDirectCallee(clang::CodeGen::CodeGenFunction&, clang::GlobalDecl) CGExpr.cpp:0:0
#<!-- -->19 0x0000000004462959 clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x4462959)
#<!-- -->20 0x0000000004462907 clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x4462907)
#<!-- -->21 0x0000000004464133 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::CallBase**) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x4464133)
#<!-- -->22 0x00000000044bbae4 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#<!-- -->23 0x00000000044b016b clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#<!-- -->24 0x00000000044b5dac clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x44b5dac)
#<!-- -->25 0x000000000443e7fe clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x443e7fe)
#<!-- -->26 0x00000000044626d5 clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x44626d5)
#<!-- -->27 0x0000000003fc4275 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x3fc4275)
#<!-- -->28 0x0000000003fcbee4 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x3fcbee4)
#<!-- -->29 0x0000000004034eb4 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x4034eb4)
#<!-- -->30 0x0000000004047bf8 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x4047bf8)
#<!-- -->31 0x00000000040af96a clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x40af96a)
#<!-- -->32 0x00000000040aac05 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x40aac05)
#<!-- -->33 0x00000000040aafdb clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x40aafdb)
#<!-- -->34 0x00000000040b57a3 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#<!-- -->35 0x00000000045e4b06 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#<!-- -->36 0x00000000045d679c clang::BackendConsumer::HandleInterestingDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x45d679c)
#<!-- -->37 0x0000000004a26b0e clang::ASTReader::PassInterestingDeclsToConsumer() (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x4a26b0e)
#<!-- -->38 0x000000000498a131 non-virtual thunk to clang::ASTReader::StartTranslationUnit(clang::ASTConsumer*) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x498a131)
#<!-- -->39 0x00000000065cd205 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x65cd205)
#<!-- -->40 0x00000000045e2668 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x45e2668)
#<!-- -->41 0x000000000489ba89 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x489ba89)
#<!-- -->42 0x000000000481e48e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x481e48e)
#<!-- -->43 0x00000000049882ce clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0x49882ce)
#<!-- -->44 0x0000000000ce254f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0xce254f)
#<!-- -->45 0x0000000000cd9fea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#<!-- -->46 0x0000000000cde02e clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0xcde02e)
#<!-- -->47 0x0000000000bacc34 main (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0xbacc34)
#<!-- -->48 0x00007c2ac3c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->49 0x00007c2ac3c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->50 0x0000000000cd9a95 _start (/opt/compiler-explorer/clang-assertions-trunk-20241217/bin/clang-20+0xcd9a95)
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation) See it live: https://godbolt.org/z/vof49fdah |
bisected to #119333 appears to be a regression since 19.x |
github-actions bot
pushed a commit
to arm/arm-toolchain
that referenced
this issue
Jan 10, 2025
…cls when PendingUndeducedFunctionDecls is not empty Close llvm/llvm-project#120277 This turns out to be a simple oversight initially. See the analysis in llvm/llvm-project@ba1e84f for the wider background.
mpark
added a commit
to mpark/llvm-project
that referenced
this issue
Feb 8, 2025
…120277. llvm@4b35dd5 was shipped to address llvm#120277 . It was thought to be a regression in 19.x according to this comment: llvm#120277 (comment) This is a test case that fails even in 17.x but nevertheless is also fixed by: llvm@4b35dd5 .
mpark
added a commit
to mpark/llvm-project
that referenced
this issue
Feb 8, 2025
…120277. llvm@4b35dd5 was shipped to address llvm#120277 . It was thought to be a regression in 19.x according to this comment: llvm#120277 (comment) This is a test case that fails even in 17.x but nevertheless is also fixed by: llvm@4b35dd5 .
mpark
added a commit
that referenced
this issue
Feb 9, 2025
…. (#126349) 4b35dd5 was shipped to address #120277 . It was thought to be a regression in 19.x according to this comment: #120277 (comment) This is a test case that fails even in 17.x but nevertheless is also fixed by: 4b35dd5
github-actions bot
pushed a commit
to arm/arm-toolchain
that referenced
this issue
Feb 9, 2025
…e for #120277. (#126349) llvm/llvm-project@4b35dd5 was shipped to address llvm/llvm-project#120277 . It was thought to be a regression in 19.x according to this comment: llvm/llvm-project#120277 (comment) This is a test case that fails even in 17.x but nevertheless is also fixed by: llvm/llvm-project@4b35dd5
Icohedron
pushed a commit
to Icohedron/llvm-project
that referenced
this issue
Feb 11, 2025
…120277. (llvm#126349) llvm@4b35dd5 was shipped to address llvm#120277 . It was thought to be a regression in 19.x according to this comment: llvm#120277 (comment) This is a test case that fails even in 17.x but nevertheless is also fixed by: llvm@4b35dd5
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
clang:modules
C++20 modules and Clang Header Modules
crash
Prefer [crash-on-valid] or [crash-on-invalid]
Given the following valid translation units:
clang crashes with
See it live: https://godbolt.org/z/vof49fdah
The text was updated successfully, but these errors were encountered: