<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54208>54208</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Bug in Libomptarget when state initialization comes from outside the translation unit
</td>
</tr>
<tr>
<th>Labels</th>
<td>
openmp
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
jhuber6
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jhuber6
</td>
</tr>
</table>
<pre>
Libomptarget uses some shared variables to track certain internal stated in the runtime. This causes problems when we have code that contains no OpenMP kernels. These variables are normally initialized upon kernel entry, but if there are no kernels we will see no initialization. Currently we load the runtime into each source file when not running in LTO mode, so these variables will be erroneously considered undefined or dead and removed, causing miscompiles.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxdUs1u2zAMfhr7Qsxw5HiJDz60HXbq0B36ApLF2Gr1Y0hUguzpRznp1g0wYIoivx9SKujr-GxUcCvJOCNBTpggBYeQFhlRw1lGI5XlLAWgKKd3mDCSNB6MJ4xeWkgkiUs5RQtCzJ6MwwZeF5NgkhvkGgODuASXBT1cEBZ5RpiCRu6RxJEvmAl8gJcV_Y-f8M7gaFPBwYSfhLAuLotOWntlUkNGWvOLBeQ1-HsboKd4rcQTqExgTkUZt91aP6CLjouxbAC39B8sSSb4Bp5yjIzDLFxog9Sf_RX7AVBOC88rxwnhZCze_PlApcwbP5epPL--gGOrRU4KBeQfP5sEhYAxBo8hJybkeSSjsWwge40n4zkKETSyCuk1RHThjLpAlhEXJmfSxJtkFTy0Wo-dHrpB1mTI4viYb1I-L3vTui3vP-tM71jYKQYHIVNRslnn_ftkbyWZO-oc7bgQranqHirxnb_Z0JJVwwB8sPb88fvCL-ANJ-KjSSlj4qDfi_ZYL-PU7qbuMB0PUnRqOExKH4ehH3opDsNetV1tpeJ1jVX_WAkR-Hm4lYOq_1abUbRCtF273x1E33XNbtBid1Rad-qwV52q9i06aWxTRDQhznUcNz0qz4kvrUmU_l7KlMzsEe9cb-wF49c7mcy0hDjek_XmY9xM_AZthSji">