<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54660>54660</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
SOLLVE — lsms_triangular_packing.cpp crashes compiler
</td>
</tr>
<tr>
<th>Labels</th>
<td>
openmp,
clang:codegen
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chichunchen
</td>
</tr>
</table>
<pre>
The test file is from: https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.0/application_kernels/lsms_triangular_packing.cpp
Error message:
```
DeclRefExpr for Decl not entered in LocalDeclMap?
UNREACHABLE executed at /b/worker/clang-release-master-x86/build/src/clang/lib/CodeGen/CGExpr.cpp:2863!
```
Clang can compile the test if the level of collapse is 3 and Clang will crash when the collapse level is 4.
```
80 #pragma omp target teams distribute parallel for collapse(4)
81 for (IndexType j=0; j<mp; ++j) {
82 // Collapsing here is fine
83 //#pragma omp target teams distribute parallel for collapse(3)
84 for (IndexType j0=0; j0<MR; ++j0) {
85 for (IndexType i=j; i<mp; ++i) {
86 for (IndexType i0=0; i0<MR; ++i0) {
```
To avoid the crash, we can modify the initialization at line 85: `i = 0`, `i = j` -> `i = MR`, or even `i = j0`.
It's weird to me why `i = j0` works but `i = j` does not (`j` and `j0` are both induction variables so I guess Clang is treating them the same way?)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVMFyozgQ_Rr50mUXloCYAwfHcWZTldmtymb2mhJCgByBKEl24v36bYk4zthTc1kKizbqbt7rbr3K1MfyuZPgpfPQKC1BOWis6QlbQ-f96NAg9B7vVvluXy0E7tH7v_96fPxni4YzWh_ky-GAdqVNhY-eOy8tGiGpw2e2SHDl46iV4F6Z4eVV2kHqsKdd7168VXxo95rbl5GLVzW0CzGOJLkjyXpat9YaC710jrcyQJr28uTjjn_vpNBPstm-jxYadA__YTAe5ICAZA1qgEcjuA4b3_lI2P0U-OPPp-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