<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/65222>65222</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Crash compiling bash
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ms178
      </td>
    </tr>
</table>

<pre>
    Compiling `bash 5.2.15` with clang version 18.0.0 (985e399647d591d6130ba6fe08c5b5f6cb87d9f6), I see the following crash with the attached trace:

```
PHINode should have one entry for each predecessor of its parent basic block!
  %160 = phi i32 [ 1, %132 ], [ %72, %127 ], [ 1, %152 ], [ 1, %155 ], [ 1, %146 ], [ 1, %149 ], [ 1, %140 ], [ 1, %143 ], [ 1, %137 ], [ 1, %130 ], [ 1, %131 ], [ 1, %129 ]
LLVM ERROR: Broken module found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/marcus/llvm18/bin/ld.lld -pie -export-dynamic --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o bash /usr/lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../lib64/Scrt1.o /usr/lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-pc-linux-gnu/13.2.1/crtbeginS.o -L./builtins -L/usr/lib -L/usr/lib -L./lib/glob -L./lib/tilde -L./lib/sh -L/home/marcus/llvm18/lib/clang/18/lib/x86_64-pc-linux-gnu -L/usr/lib64/gcc/x86_64-pc-linux-gnu/13.2.1 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib -plugin-opt=mcpu=haswell -plugin-opt=O3 -plugin-opt=-function-sections=1 -plugin-opt=-data-sections=1 -plugin-opt=cs-profile-path=/home/marcus/Downloads/all.profdata --lto-CGO3 --gc-sections --icf=all --lto-O3 -O3 -Bsymbolic-functions --as-needed -mllvm -polly -mllvm -polly-invariant-load-hoisting -mllvm -polly-loopfusion-greedy -mllvm -polly-run-inliner -mllvm -polly-run-dce -mllvm -polly-enable-delicm=true -mllvm -extra-vectorizer-passes -mllvm -enable-cond-stores-vec -mllvm -slp-vectorize-hor-store -mllvm -enable-loopinterchange -mllvm -enable-loop-distribute -mllvm -enable-unroll-and-jam -mllvm -enable-loop-flatten -mllvm -interleave-small-loop-scalar-reduction -mllvm -unroll-runtime-multi-exit -mllvm -aggressive-ext-opt -mllvm -enable-interleaved-mem-accesses -mllvm -enable-masked-interleaved-mem-accesses -zmax-page-size=0x200000 -mllvm -adce-remove-loops -mllvm -enable-ext-tsp-block-placement=1 -mllvm -enable-gvn-hoist -mllvm -enable-dfa-jump-thread --push-state -whole-archive -ljemalloc_pic --pop-state -lpthread -lstdc++ -lm -ldl --undefined-version shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o expr.o flags.o jobs.o subst.o hashcmd.o hashlib.o mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o alias.o array.o arrayfunc.o assoc.o braces.o bracecomp.o bashhist.o bashline.o list.o stringlib.o locale.o findcmd.o redir.o pcomplete.o pcomplib.o syntax.o xmalloc.o -lbuiltins -lglob -lsh -lreadline -lhistory -ltinfo -ltilde -ldl -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib64/gcc/x86_64-pc-linux-gnu/13.2.1/crtendS.o /usr/lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../lib64/crtn.o
 #0 0x0000563456c7ce48 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/marcus/llvm18/bin/ld.lld+0x307ce48)
 #1 0x0000563456c7d3fd SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f6f9ca23010 (/usr/lib/libc.so.6+0x223010)
 #3 0x00007f6f9ca9160d pthread_kill (/usr/lib/libc.so.6+0x29160d)
 #4 0x00007f6f9ca22f52 gsignal (/usr/lib/libc.so.6+0x222f52)
 #5 0x00007f6f9ca004a0 abort (/usr/lib/libc.so.6+0x2004a0)
 #6 0x0000563455d0143d llvm::report_fatal_error(llvm::Twine const&, bool) (/home/marcus/llvm18/bin/ld.lld+0x210143d)
 #7 0x0000563455bcb525 (/home/marcus/llvm18/bin/ld.lld+0x1fcb525)
 #8 0x00005634567265e5 (/home/marcus/llvm18/bin/ld.lld+0x2b265e5)
 #9 0x000056345672652d llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) LTOBackend.cpp:0:0
#10 0x000056345625b609 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/marcus/llvm18/bin/ld.lld+0x265b609)
#11 0x0000563457b71c3d llvm::lto::opt(llvm::lto::Config const&, llvm::TargetMachine*, unsigned int, llvm::Module&, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex const*, std::vector<unsigned char, std::allocator<unsigned char>> const&) (/home/marcus/llvm18/bin/ld.lld+0x3f71c3d)
#12 0x0000563457b7311b llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) (/home/marcus/llvm18/bin/ld.lld+0x3f7311b)
#13 0x00005634566b9047 llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>) (/home/marcus/llvm18/bin/ld.lld+0x2ab9047)
#14 0x00005634566b7130 llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, std::function<llvm::Expected<std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>> (unsigned int, llvm::StringRef, llvm::Twine const&)>) (/home/marcus/llvm18/bin/ld.lld+0x2ab7130)
#15 0x0000563456e53ef7 lld::elf::BitcodeCompiler::compile() (/home/marcus/llvm18/bin/ld.lld+0x3253ef7)
#16 0x0000563456d96b5f lld::elf::LinkerDriver::link(llvm::opt::InputArgList&) (/home/marcus/llvm18/bin/ld.lld+0x3196b5f)
#17 0x0000563456d82a1a lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/home/marcus/llvm18/bin/ld.lld+0x3182a1a)
#18 0x0000563456d80543 lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/home/marcus/llvm18/bin/ld.lld+0x3180543)
#19 0x0000563456c7e9a3 lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/home/marcus/llvm18/bin/ld.lld+0x307e9a3)
#20 0x000056345654249a lld_main(int, char**, llvm::ToolContext const&) (/home/marcus/llvm18/bin/ld.lld+0x294249a)
#21 0x000056345654224c main (/home/marcus/llvm18/bin/ld.lld+0x294224c)
#22 0x00007f6f9ca01f47 (/usr/lib/libc.so.6+0x201f47)
#23 0x00007f6f9ca02004 __libc_start_main (/usr/lib/libc.so.6+0x202004)
#24 0x0000563456bed2e1 _start (/home/marcus/llvm18/bin/ld.lld+0x2fed2e1)
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWl1v27jS_jXKDUFBoizZushFEifvFk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