<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96941>96941</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
memcpy() missing from clang's intrin.h on Windows
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
a-p-jo
</td>
</tr>
</table>
<pre>
To reproduce this issue:
Try to compile the below code on clang on windows (for example, if installed through visual studio, run `clang <filename>.c` in the Developer Command Prompt):
```c
#include <intrin.h>
int main(void)
{
memcpy((void *)0xdeadbeef, (void *)(0xdeadbeef+1), 1);
}
```
The following error message will be printed:
```c
error: call to undeclared library function 'memcpy' with type 'void *(void *, const void *, unsigned int)'; ISO C99 and later do not support
implicit function declarations [-Wimplicit-function-declaration]
| memcpy((void *)0xdeadbeef, (void *)(0xdeadbeef+1), 1);
| ^
note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
```
Refer [microsoft documentation](https://learn.microsoft.com/en-us/cpp/intrinsics/intrinsics-available-on-all-architectures): `mempcy` is listed under a table titled "_The following UCRT functions have intrinsic forms on all architectures:_". So, the symbol should be defined in `intrin.h`.
The code compiles with gcc (minGW) as well as msvc (visual studio built tools).
Upon some ctrl+click-ing to and ctrl+f-ing through the `intrin.h` (and its `#include`s) that `clangd` uses in visual studio code on windows, it appears that the llvm/clang version of this header file does not export the symbol `memcpy`, when it should.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU2P4jgT_jXmUgIFhxByyKGhp1-9p13N9GiOI8euEM_6I7IdGP79qpJAh969LkKQ2OX6fJ7HIkZ9dog1K46seF2JIXU-1GLdr3_5VePVrX73ELAPXg0SIXU6go5xQJa_sOyVZS_v4QbJg_S214YsEBo0_grSKwTvQBrhzvRw1U75awTGD60PgL-F7Q0yfgLdgnYxCWNQQeqCH84dXHQchIGYBqU9WYXBAdtnkz-Wn1pt0A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