<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64024>64024</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Crash in clang::CodeGen::CodeGenModule::GetOrCreateLLVMFunction
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
anbu1024
</td>
</tr>
</table>
<pre>
clang version
```
clang --version
clang version 16.0.6
Target: x86_64-unknown-linux-gnu
Thread model: posix
```
Test case:
```
volatile int global;
static void foo()
{
global = 1;
}
int bar()
{
foo(foo);
return 0;
}
```
Backtrace
```
./mini.c:11:10: warning: too many arguments in call to 'foo'
foo(foo);
~~~ ^
./mini.c:11:6: warning: passing arguments to 'foo' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
foo(foo);
^
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: clang-16 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name mini.c -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 -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/media/Store/Project/C-compiler/crashes/llvm/2023-0007 -resource-dir /media/Store/Installs/llvm/16.0.6/llvm-project-16.0.6.install/lib/clang/16 -internal-isystem /media/Store/Installs/llvm/16.0.6/llvm-project-16.0.6.install/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/media/Store/Project/C-compiler/crashes/llvm/2023-0007 -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/mini-39987c.o -x c ./mini.c
1. <eof> parser at end of file
2. Per-file LLVM IR generation
#0 0x0000563f66356eb8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (clang-16+0x2d84eb8)
#1 0x0000563f66354e2e llvm::sys::RunSignalHandlers() (clang-16+0x2d82e2e)
#2 0x0000563f6635764d SignalHandler(int) Signals.cpp:0:0
#3 0x00007fba1f20a420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x0000563f6661c035 replaceUsesOfNonProtoConstant(llvm::Constant*, llvm::Function*) CodeGenModule.cpp:0:0
#5 0x0000563f6660d93e clang::CodeGen::CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef, llvm::Type*, clang::GlobalDecl, bool, bool, bool, llvm::AttributeList, clang::CodeGen::ForDefinition_t) (clang-16+0x303b93e)
#6 0x0000563f6661318a clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl, llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t) (clang-16+0x304118a)
#7 0x0000563f665ff25e clang::CodeGen::CodeGenModule::GetAddrOfGlobal(clang::GlobalDecl, clang::CodeGen::ForDefinition_t) (clang-16+0x302d25e)
#8 0x0000563f665fd2c1 clang::CodeGen::CodeGenModule::EmitDeferred() (clang-16+0x302b2c1)
#9 0x0000563f665fb32d clang::CodeGen::CodeGenModule::Release() (clang-16+0x302932d)
#10 0x0000563f66ec0204 (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#11 0x0000563f66ebdf49 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#12 0x0000563f67f2699d clang::ParseAST(clang::Sema&, bool, bool) (clang-16+0x495499d)
#13 0x0000563f66dfa647 clang::FrontendAction::Execute() (clang-16+0x3828647)
#14 0x0000563f66d6f584 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (clang-16+0x379d584)
#15 0x0000563f66eb859f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (clang-16+0x38e659f)
#16 0x0000563f65339724 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (clang-16+0x1d67724)
#17 0x0000563f65336dbe ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#18 0x0000563f65336a33 clang_main(int, char**) (clang-16+0x1d64a33)
#19 0x00007fba1ecca083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#20 0x0000563f65332dee _start (clang-16+0x1d60dee)
clang-16: error: unable to execute command: Segmentation fault (core dumped)
clang-16: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 16.0.6
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /llvm/16.0.6/llvm-project-16.0.6.install/bin
clang-16: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-16: note: diagnostic msg: /tmp/mini-77e5bd.c
clang-16: note: diagnostic msg: /tmp/mini-77e5bd.sh
clang-16: note: diagnostic msg:
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WE9T47gS_zTm0qWULTt2fOAQEjIzVexCAbt7TMlS22jXllySzMBlP_sryYbEEObtzLx9VTMhkdv9-3Wr_0nMWtkoxPNoeREtt2dscA_anDNVDUlMs7NKi-dz3jLVwCMaK7WK4m0Ur6M8nv6Fn6MEITOZ2WuQ5It4kY9P7plp0EXpGp5W-T7PyKD-UvqrIq1UwxNp1DDJPRhkAjotsPXSvbby6SSBSR6tA84sRun6G2KPumVOtghSOWhaXbE2Si-OJaxjTnJ41FJArXVEVxEtJ4FikpzehCjdQnJ4v9geK_IIFTOnFUyqw2f5qgHA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