<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/152174>152174</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang][OpenMP] Initialize variables of omp_nest_lock_kind to a known bad value (e.g., -1)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:openmp
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
eugeneepshteyn
</td>
</tr>
</table>
<pre>
Currently, if one declares an automatic variable of type `integer(kind=omp_nest_lock_kind)` and forgets to call `omp_init_nest_lock()`, and then proceeds to call `omp_destroy_nest_lock()`, there's a crash due to uninitialized nest lock variable.
Would it be possible to detect that instantiations of integer variables of `omp_nest_lock_kind` kind and always initialize them to some known bad value (e.g., -1)?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEksGK2zAQhp9GvgxrbNmO7YMP2Q2BHkp763EZSxNbjSwZaZwlffqibNjQLqUngdA3-v-PwRjN5IgG0TyL5pDhxrMPA20TOaI1zkxXl41eX4eXLQRybK9CvoA5gXcEmpTFQBHQAW7sF2Sj4ILB4GgJ_An4uhKIXWEc00RByO5snBbVwS_rq6PIr9ar8-vtUvZiVwA6DScfJuII7EGhtWlAem-c4QckZPeOpECJ4pkcrMErIv2J1RQ5-Os_cJ4pkJBtBAQVMM6gN0ojNpc-NWjNL9KQYEjwR8dcFHtR7H_4zWowDCPB6mM0qT570MSkGHhGBuMio2ODbLyLSc5dysew2-U9719udgWk89YT7RteIzyCpfhL-i76heDs_JuDETVc0G4EQnaUT3mq-VSmytUx00Ol-6rHjIaybeq6LNtdm80DtURl1xWVUu2p1lWlJcq-L6ju-makJjODLGRTdEVT7qpd0ebjSfdjWammL8e-USjqghY0Nrf2suQ-TJmJcaOhbGTZ1pnFkWy8rZuUJ4tuEtXer-SWVUiZVjAMiXwatymKurAmcnzMYsP2tqzvaHMQzfO3ldzX76I5wJeHkT-UfvaZZOF_TWVbsMPMvEZR7YU8CnmcDM_bmCu_CHlMse7H0xr8T1Is5PHWNwp5vFe-DPJ3AAAA__-T9iLO">