<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJylVN9zmzgQ_mvwi8aMAGOcBz9gjFNf_OuIc5c3RkgLphGIkyBN-tffYuwmbTPtzJ1HRtpvV7vfrlbKlHidR0oAgRfgXVuqmphWNYaw1qJLi4bWlF7GWTww3ZZcwj20B6Wk5YU4NKuFqsqvQCh5Z2Dsiwt_cXt4IFuolH4lsdZKW_6ShEJo3Ezoy8Shlx9JgBlV9_CBFUBq1ZJGg4G6JUoT0zWgn0uDy0aXz6WEAmwyRLm4Z5yDMSRnnWxJ9kr6yDUmOHaI5c7Covd0Qr4ShtjBNGMBtdwbgqkzpNTvfk_J_i-cPqzd8E2g0Up0HPSHRkXZEi5VDeTUto3pC-yucCB-6jKbqwqFP7fRIYzucPVPxRvGn4a9XBDyHXB2dgL-pLqWiOlNxmHGg4BOKQrC8_NgNps64FOHTSd0xj2eAwxbqydRapJ1pRQpq0TBsQALghG-g4awFXsCMl5G2_AuTqM02m8P602cWN6SS1YXb6rHx5-UlrvAgSaYU4oqxPerFcrxLlxs4hSFzT5c9vAO0Yd7hBZ_xNExPYbJbXy8Ki52b-jAcIxT_z8ZdolxNUz20Tb9e5_chcn-YbdMF0m4iz6l6116CJNws4k336hct4RJ9AnBIn-5odNvWcWPcbpZ7-7iJF1twtt7tBjLitiXJhiK89lzSQumTZvL_RiUNh6h0Ry_13uDy97OXOYf7H9olnVLDEBliCwxSAYlFpuzzoDoW7-sudIaOPZAf8Ox9UGz_orbZJ2TNaJVhU08uPpFt73CWHbqXbO5q0yqDCeAzJsJ4fdtlAs_m3A2cT2Wixwc8Kjn5Y4jKM0-yvJesWVpWlZzOLJMQrjAzjgyXUBrnyzX27huMFBrT3CuHWmYMWBscrwC57x0VxvyBQn3TV4a0wH5coKaqDyXiom-Jq0iu7_Wy3XYPwfGHom5J268GzZiHW7T8yHDUafl_Bd1kPL5Oo3xDn_GyqJ4jtgfl-_51B-d5pj9DOuCD4vn0MCbOV7As8yfOjlz_TzPRpJlIM0cn0XLdVUDddXgAp_E0f8PX85d6rrU8RzXcxxnZouJoC6l3iwI3IDnvjWhULFS2r0fW-lipOdnl1lXGFRKPBPzpsSKl0UNcGaLDNuylWdhj7y3B4RwHW6Xt9Guf9N__wiPzoTnZ7b_An_zBiI>53505</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [OpenMP][AMDGCN] Memory access fault by GPU node-1 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            openmp
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          ye-luo
      </td>
    </tr>
</table>

<pre>
    Code execution stops at
```
ParticleSetPool::randomize 0 ParticleSets.
[GPU Memory Error] Addr: 0x4100000000 Reason: Page not present or supervisor privilege. 
Memory access fault by GPU node-1 (Agent handle: 0x76ba70) on address 0x4100000000. Reason: Page not present or supervisor privilege.
```

Reproducer
```
git clone https://github.com/QMCPACK/qmcpack
cd  qmcpack
git checkout d69bce8c77060d69d35f78861e501a6408c3cfee
mkdir build_amdgcn; cd build_amdgcn
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DQMC_MPI=OFF -DENABLE_OFFLOAD=ON -DUSE_OBJECT_TARGET=ON -DOFFLOAD_TARGET=amdgcn-amd-amdhsa -DQMC_OFFLOAD_ROCM_WORKAROUND_BRANCH_IN_PARALLEL=OFF -DOFFLOAD_ARCH=gfx906 -DCMAKE_EXE_LINKER_FLAGS=-lm ..
make -j32 test_particle
./src/Particle/tests/test_particle
```
It seems like being caused by incorrect code generation. If I comment
https://github.com/ye-luo/qmcpack/blob/eeb38dd57886fd5b4ca423afdfe1e3033f11d00b/src/Particle/SoaDistanceTableABOMPTarget.h#L227
the test passes. The test code runs without issue when offloading to NVIDIA GPUs.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVN9zozYQ_mvw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