<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94616>94616</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[OpenMP] Strict aliasing violation in TargetValue::getValue()
</td>
</tr>
<tr>
<th>Labels</th>
<td>
openmp
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nikic
</td>
</tr>
</table>
<pre>
This bit of code looks a bit suspect:
https://github.com/llvm/llvm-project/blob/24a39f364dbef7e18d36be3919eacde32125df5e/openmp/libompd/src/TargetValue.h#L232-L252
This passes in `T& buf`, then reads into it via getValue() -- this part is fine, as that's essentially done via memcpy.
But then `buf` is cast to `uintN_t *`, dereferenced, cast to `T` and written back to `buf`. This is not compatible with strict aliasing in C.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUkkFvnD4QxT-NuYwWwRi8cOCwScQp_38rddVrZfCwuPHaCA8b5dtXZhM17a0XkD3M472Zn47RXjxRJ-oHUT9leuM5rJ23L3bMhmDeuvNsIwyWIUwwBkPgQniJoPe7uMWFRhbyJIonUZxm5iWmE_YC-4vleRvyMVwF9s7dPl6HZQ0_Uxv2gwuDwB4rLdtJqsoMNB2pbIxUA8m2bEmPhiSWWJupJoF9WMhfl6Rkh3BdjMA-rqPA_qzXC_F37TbKZ4HyGSUenrHGu7X7c0-z6BgpgvUgVHEWqGDYJqEKgY_AM3lYSZtU5wCW4WY1fCgLbAS2cDgA35VWBhthsp5St47As2aBxwgUI3m22rk3MMHTrnOl67i85Z8tPWx8_6tQxd1HUhx1ZOCQLjfr-f8fDAJP7yYNrTTRSn4kk86fPj6nfu0NvK6WmTwMenx5r93Vc9iHYCP4wDCG66LZDo7g1fIMkVc7MmhndbT-kob0mGemk6aVrc6oK4_lUTVF3WI2d-0kmwEbdayLqSYl20m1-khGVbKqcFKZ7bDAqlCFKiW2NeaVUUrqpjmWddHgSKIq6KqtyxMYeVgvmY1xo66tVKkypwdycYcT8WPzmEBdu52kYbtEURXORo6_Jdiy25H-spD_76uon-DbX7luNjjNNviU8BM6CV55-nPd2ba67p_R3nNEgf09yq3DXwEAAP__6CsVTg">