<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65227>65227</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C API] GetOrdering/IsAtomicSingleThread do not work for fence/load/store
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Benjins
</td>
</tr>
</table>
<pre>
Two related issues with atomics in the C API:
- `LLVMGetOrdering` currently does not support fence instructions
- `LLVMIsAtomicSingleThread` currently does not support fence or load/store instructions
In both cases, we will cast the unsupported instruction types to an unrelated type (whatever the else branch assumes it is), which will result in reading garbage. This will crash if assertions are enabled, otherwise it will just return whatever value it gets: in the case of `LLVMGetOrdering` this can return invalid enum values
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMk0Fr4zoUhX-NvLk0KLKdxAsv0hY_Cn28B1NmL1s3ljqKFHSvYvrvB9vNtDPMwGxsENJ37jk60kRuDIitqO9F_VjozDam9h7DqwtU9NG8tS9ThIReMxpwRBkJJscWNMezGwhcALYID3D8_0mURyEfhTzCHYidfH7--u8_yP8lg8mFUewkDDklDOzfwEQkCJGB8uUSE8MJw4DgAnHKA7sY6FfWEx0X0S8ujB5fbEJt_goaE_iojVAdcUw_i8Cqsn6fAvSRLQyakIR6gAlhct7PC7z4zOEdPcfxgQF-uyABR9ABcrgFNq-CUIfJasYrpgWBnhD6pMNgQRPlMxI4BkdCNYumdYNdZRNS9jxnPHt1YYRRp16PuIEX6-h9tqTJgjvNMEyrKZ0QMOjeo5mRkS2myRHOQsuh10wMCTmnAD-mu2qfly0jMonyeLvcOQ6Ipz_cKc-TDDrccC5ctXcGMOTziqTCtKVpykYX2G53TbmvarU7FLZt6gZN0-vB7KteopGNxANqUw3bCvfbfeFaJVUpG1luVbWvDpv-VNcHedrvtlsph7IXlcSzdn7j_fW8iWkslpa2u1qpfeF1j56WfisVcForLJSa657a-cxdn0cSlfSOmD4o7NgvD2Ntdv0In22r7ndlBBOX9k0xfYNTTGv9hOo-t6_IybeW-TInLFQnVDc6trnfDPE87_XX2-_ukuIrDixUtz49obrF1_cAAAD__-v1RK0">