<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58659>58659</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Crash on malformed ll
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mimvdb
</td>
</tr>
</table>
<pre>
Hi, clang told me to report this bug.
```
$ clang -Wno-override-module -O1 -Wall -o output/exec output/test_4.ll
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: /usr/lib/llvm-14/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test_4.ll -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -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=/home/mim/src/... -resource-dir /usr/lib/llvm-14/lib/clang/14.0.0 -O1 -Wno-override-module -Wall -fdebug-compilation-dir=/home/mim/src/... -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/test_4-b43868.o -x ir output/test_4.ll
1. Optimizer
#0 0x00007ff7de23fd01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3fd01)
#1 0x00007ff7de23da3e llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3da3e)
#2 0x00007ff7de240236 (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe40236)
#3 0x00007ff7dcc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007ff7defce7eb (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1bce7eb)
#5 0x00007ff7defcbfc0 (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1bcbfc0)
#6 0x00007ff7defca699 llvm::ADCEPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1bca699)
#7 0x00007ff7e0d53bfd (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x3953bfd)
#8 0x00007ff7de3aea3e llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xfaea3e)
#9 0x00007ff7dff9927d (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x2b9927d)
#10 0x00007ff7df52013f llvm::CGSCCToFunctionPassAdaptor::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x212013f)
#11 0x00007ff7dff9abad (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x2b9abad)
#12 0x00007ff7df51c628 llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x211c628)
#13 0x00007ff7df2ceccd (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1ececcd)
#14 0x00007ff7df51e7f6 llvm::DevirtSCCRepeatedPass::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x211e7f6)
#15 0x00007ff7df2cf3ad (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1ecf3ad)
#16 0x00007ff7df51dba3 llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x211dba3)
#17 0x00007ff7df2cf1cd (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1ecf1cd)
#18 0x00007ff7de3ad63e llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xfad63e)
#19 0x00007ff7df2ca273 llvm::ModuleInlinerWrapperPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x1eca273)
#20 0x00007ff7e0d4b1ad (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0x394b1ad)
#21 0x00007ff7de3ad63e llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xfad63e)
#22 0x00007ff7e5662b9b (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1862b9b)
#23 0x00007ff7e5656a52 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1856a52)
#24 0x00007ff7e59791e0 clang::CodeGenAction::ExecuteAction() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x1b791e0)
#25 0x00007ff7e6314b57 clang::FrontendAction::Execute() (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x2514b57)
#26 0x00007ff7e626c3a6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x246c3a6)
#27 0x00007ff7e638e45b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib/x86_64-linux-gnu/libclang-cpp.so.14+0x258e45b)
#28 0x000000000041328b cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-14/bin/clang+0x41328b)
#29 0x00000000004114bc (/usr/lib/llvm-14/bin/clang+0x4114bc)
#30 0x0000000000411307 main (/usr/lib/llvm-14/bin/clang+0x411307)
#31 0x00007ff7dcc29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#32 0x00007ff7dcc29e40 call_init ./csu/../csu/libc-start.c:128:20
#33 0x00007ff7dcc29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#34 0x000000000040e3b5 _start (/usr/lib/llvm-14/bin/clang+0x40e3b5)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Ubuntu clang version 14.0.0-1ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
```
Context: it's a ll file with some instructions referencing names that have not been created e.g.
```ll
%_countdecr607 = sub i64 %_count606, 1
store i64 %_countdecr607, i64* %_countptr597
%_array602 = bitcast i64* %_raw_array601 to { i64, [0 x i64] }*
%_raw_array601 = call i64* @alloc_array(i64 %_bop600)
%_bop600 = add i64 %_i598, %_col599
%_col599 = load i64, i64* %_col586
%_i598 = load i64, i64* %_countptr597
%_gep609 = getelementptr { i64, [0 x { i64, [0 x i64] }*] }, { i64, [0 x { i64, [0 x i64] }*] }* %_array596, i32 0, i32 1, i64 %_countdecr607
store { i64, [0 x i64] }* %_array602, { i64, [0 x i64] }** %_gep609
br label %_cond603
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWltv27gS_jXOCyFDN8vWQx5cO2kXaNGi6W4fDYoc2dyj26GoXPbXnxlKtkXXaRIXB3uAPUHgyBTn4zffzFAUmayWT9cf1CRcMVHwastMXUhWAv5lGppaG2Z2qmVZt51O_PXEXw6fiT_89l_DeLD3vle1V9-D1kqCV9ayK4B5nwO8wYuCMa9mdWeazkzCW3gEcfxmoDWbeFoUPeSXjzfLuxvWdlmpDOPE4MCoZjtjmnYS4cC3-LtVZtdlU1GX-KUo7vd_vEbXf4IgdNW2HbR4wXglmapE0Un0cgdMaN7uWMbFv4zmAkiKBgfStYC2BcnautN9M1nytq2F4gZv6K5irdCqMYM0dwZBmOzKhpjZJh9vpV90vdW8ZFxvuxIqQ8QZUulaTURVtqcbxHiVqQo_BzWFQOUMjoEqPi6STRJ7jfAKVXWP3rbqmAeojldnfzLPKzUU_NHDz1pwo-qqZZ5ULc8K8HINGAZRANceb42XQV5r8MhrQK8O_SwNjJ7KFWjbLLiW3j0vOvAqXgJillxVXq6KvoEd4sYsg2FsCj0UrFGCefjhFXCPX8P-i2rxD_Ipc5QFvKZWlQE9idZVXWFzXnKz8zCFqhq_5I0n6opiY7BHXWETppiuu0qqautRX0TCLq3RnTA1Olgo3hLTvKseVCU9Q76h6msc32AUwHii6UhQL4mxqavANmyhQteRcUk6kPDAjYcSFL2I6hEk8aIxWu-B60pRkCRgcm5BExA24DhbmeHoguqAbxG7LhtV9LpIRY5ihHd1iVl1WyrK1lYL_JxOpwzj12cc9Xw-S_rvNkvwbxBP_ak_1Nm5ArTF5-WW6dvo5L2_haIyDFJswLwTlCMt2qNtPA2ngfW2wH5S8W1Vt0YJ0p9Lid1QovVm83612nxY_nGzWX9ffr0NN6vb3zbLu0-IENCsQDMAFs5-HvCyOFoki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