<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/109836>109836</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[analyzer] FP "uninitialized read" with hand-written memcpy
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pskrgag
</td>
</tr>
</table>
<pre>
ExprEngine now binds only to offset 0 in case of inline assembly input. This causes false-positive uninitialized read reports in following case:
(snippet adapted from real code base)
```c
void *MyMemcpy(void *d, const void *s, const int n) {
asm volatile (
"cld\n rep movsb\n"
:: "S" (s), "D" (d), "c" (n) : "memory"
);
return d;
}
void proccess(const void *src, unsigned long len)
{
int a[10], c;
unsigned long toCopy = sizeof(a) < len ? sizeof(a) : len;
MyMemcpy(a, src, toCopy);
for (unsigned long i = 0; i < toCopy; ++i)
c = a[i]; // warning here on index > 0
}
```
(see example on godbolt https://godbolt.org/z/1e7E1cM7P).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkVMuOqzoQ_Jpm05qImBBgwSKPyW6kI937A8buEN9rbGSbZDJff2ST1zw0IqHorq4qOubeq94QtVBuodxnfAon69rR_-963medldf2_XN076ZXhtDYC3bKSI_W6CsGi_Z49BQwR2VQcE9oj6iMjsXcexo6fUVlxiks8N-T8ij45MnjkWtPb6P1Kqgz4WSUUUFxrb5IoiMeL6N1wUfeo9XaXpTp0wQoNpDvIb9fWe2NGkcKyCUfA0k8OjtEEo3CSsIuNrHmW9M6n__FfH-2SiKwzcf1gwYxXoHVd0gC26Gwxge8Q_4JKRPQAGsQqu1Mhcj9gGereVCaEFh9xxGBMaEllDsT7eFgz76Ld8DYS1GxgWITa_8BxiKBj-rZLkL7GySfkLhBs4y5c6DBuusLbSwvHgodhckZlA8Iqv1rPMno6KwQ5D2w-od9J-LoyaTVkait6VGTeWb8zAJTQhzK7TKHcp-Cewr5ThHszo5XhGKPXn2RPQKr-WxqF_kRisOvJ5s0-eFj5n15jTyOvCmeB7xG8ZR5tC6G-F2RSmJyKLbp64Oh2CKwLbCtenjG9CdSQ7SrottUdwB2wAt3Ji7wiRyhNaiMpE-E4h3zn2_gvpr4c8uJkD75MOrE0FvZWR3wFMLo486kQTd0YV0P7PAF7LCk6n0pPqo_wJpFJttCNkXDM2qXFauWTV2v8-zUriqSXS5zseyaqisZNZJXUhZrQbwpGGWqZTlb5Q1bxb5VvliXRd2IuipXq5xVjGCV08CVXmh9HuL8THk_UbvMm7pYZ5p3pH06ZhgzdMH0NG5ouc9cG5veuqn3sMq18sE_aYIKOp1P3HB9_SIH5R4Pf-Ka_z424m_hosIJT9zIt4tTIZDBIW1DNjnd_ohLhdPULYQdgB3ixNvH2-jsfyQCsEPS6WOQs5Fzy_4GAAD__7B7iJI">