<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61403>61403</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
MemorySanitizer: use-of-uninitialized-value with std::to_string + char
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
buscher
</td>
</tr>
</table>
<pre>
Code:
```
#include <string>
#include <iostream>
int main(int, char **)
{
std::cout << std::to_string(1) + '.' << '\n';
return 0;
}
```
Output:
```
ASM generation compiler returned: 0
Execution build compiler returned: 0
Program returned: 1
Uninitialized bytes in __interceptor_fwrite at offset 1 inside [0x7ffec130a4e0, 2)
==1==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x7f2d8609aeac (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0x144eac) (BuildId: c087edfc1f81689deb0ac7b6587b560b4cb54c64)
#1 0x556a3ed0e726 (/app/output.s+0xa8726)
#2 0x7f2d85bc2082 (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
#3 0x556a3ec8535d (/app/output.s+0x1f35d)
SUMMARY: MemorySanitizer: use-of-uninitialized-value (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0x144eac) (BuildId: c087edfc1f81689deb0ac7b6587b560b4cb54c64)
Exiting
```
Compiler Explorer: https://godbolt.org/z/8Wb9dPq34
I might be related to https://github.com/llvm/llvm-project/issues/48689 but triggers differently.
The '.' (dot) triggers the uninitialized warning, but it seems initialized.
If I am wrong here, please correct me :)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVU2P2zgP_jXKRUggU7YsH3JIMs2LOUzfot2i2NNAH7SthWNlJbmT6a9fyEmame50ge5pAUNKRIp8-FAkVYyuGxHXpNqS6m6hptT7sNZTND2Ghfb2eb3zFgnfE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