<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65532>65532</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
msan false positive on FreeBSD in isprint() after setlocale()
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tavianator
</td>
</tr>
</table>
<pre>
The following program:
```console
$ cat foo.c
#include <ctype.h>
#include <limits.h>
#include <locale.h>
#include <stdio.h>
int main(void) {
setlocale(LC_ALL, "C.UTF-8");
return isprint(0x7F);
}
```
when compiled with `clang16 -fsanitize=memory` on FreeBSD:
```console
$ clang16 --version
clang version 16.0.6
Target: x86_64-portbld-freebsd13.1
Thread model: posix
InstalledDir: /usr/local/llvm16/bin
$ clang16 -g -fsanitize=memory foo.c -o foo
$ elfctl -e +noaslr ./foo # Work around https://github.com/llvm/llvm-project/issues/53256
```
crashes with a use-of-uninitialized-value error that (I hope) is wrong:
```console
$ ./foo
==21589==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x10bf805 in __sbmaskrune /usr/include/_ctype.h:109:2
#1 0x10bf4c9 in __sbistype /usr/include/_ctype.h:122:12
#2 0x10bf336 in main /usr/home/tavianator/code/bfs/foo.c:8:9
SUMMARY: MemorySanitizer: use-of-uninitialized-value /usr/include/_ctype.h:109:2 in __sbmaskrune
Exiting
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVU1v4zYQ_TXjC2FBGtq0dNDBiVdFgGQPmywWPQWUNJLYpUiDpJxkf32hj9RJkLTpGgZJzBs-D998WHqvWkOUw_YCtoeVHEJnXR7kSUkjg3Wr0tZP-V1HrLFa2wdlWnZ0tnWyB76H-ADx8yri-VtZ462mxYobVsnAGmuj6tnElan0UBMDflmFpyNFHfAv76Fa9Sr4j2FbSf3xbR9qZV-i06pMYL1UBjA9WVUDZgx2FzPGPIWZFDC9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