Issue |
131223
|
Summary |
[clang] Clang Assertion Failure in `CodeGenModule::UpdateMultiVersionNames` with Recursive `Multi-versioned` Function
|
Labels |
clang
|
Assignees |
|
Reporter |
bi6c
|
Code explorer: [https://godbolt.org/z/rvrzh6rdj](https://godbolt.org/z/rvrzh6rdj)
generated by fuzzer
**Code:**
```c
int f_(void) __asm__("f");
int __attribute__((target_clones("default,avx"))) f(void) {
return f_();
}
int main(void) {
return f();
}
```
**stack trace:**
```
clang-21: /root/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:1987: void clang::CodeGen::CodeGenModule::UpdateMultiVersionNames(clang::GlobalDecl, const clang::FunctionDecl*, llvm::StringRef&): Assertion `OtherGD.getCanonicalDecl() .getDecl() ->getAsFunction() ->isMultiVersion() && "Other GD should now be a multiversioned function"' 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-20250313/bin/clang-21 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -main-file-name example.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-assertions-trunk-20250313/lib/clang/21 -internal-isystem /opt/compiler-explorer/clang-assertions-trunk-20250313/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.1/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-8fb254.o -x c <source>
1. <source>:7:1: current parser token 'int'
2. <source>:3:51: LLVM IR generation of declaration 'f'
3. <source>:3:51: Generating code for declaration 'f'
#0 0x0000000003e7dc08 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x3e7dc08)
#1 0x0000000003e7b5c4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x0000702a32042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x0000702a320969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x0000702a32042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x0000702a320287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x0000702a3202871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x0000702a32039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x00000000043fc87a clang::CodeGen::CodeGenModule::UpdateMultiVersionNames(clang::GlobalDecl, clang::FunctionDecl const*, llvm::StringRef&) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x43fc87a)
#9 0x000000000443408a clang::CodeGen::CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef, llvm::Type*, clang::GlobalDecl, bool, bool, bool, llvm::AttributeList, clang::CodeGen::ForDefinition_t) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x443408a)
#10 0x0000000004436e68 clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl, llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x4436e68)
#11 0x00000000044371e9 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x44371e9)
#12 0x000000000443a3a4 clang::CodeGen::CodeGenModule::EmitMultiVersionFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x443a3a4)
#13 0x00000000044325a5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x44325a5)
#14 0x000000000443298b clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x443298b)
#15 0x000000000443cd63 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#16 0x000000000483ad46 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#17 0x000000000482ad04 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x482ad04)
#18 0x000000000643bc44 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x643bc44)
#19 0x0000000004837528 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x4837528)
#20 0x0000000004b00005 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x4b00005)
#21 0x0000000004a8398e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x4a8398e)
#22 0x0000000004bedf9e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0x4bedf9e)
#23 0x0000000000d5391f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0xd5391f)
#24 0x0000000000d4b2da ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#25 0x0000000000d4f47b clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0xd4f47b)
#26 0x0000000000c17ff4 main (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0xc17ff4)
#27 0x0000702a32029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#28 0x0000702a32029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#29 0x0000000000d4ad85 _start (/opt/compiler-explorer/clang-assertions-trunk-20250313/bin/clang-21+0xd4ad85)
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: 254
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs