xref: /llvm-project/compiler-rt/test/msan/__strxfrm_l.cpp (revision 10aa0d7bbc12bf86958bc40943e37b46c6eed04a)
1 // RUN: %clangxx_msan -std=c++11 -O0 -g %s -o %t && %run %t
2 // REQUIRES: x86_64-linux
3 
4 #include <assert.h>
5 #include <locale.h>
6 #include <sanitizer/msan_interface.h>
7 #include <stdlib.h>
8 #include <string.h>
9 
10 extern "C" decltype(strxfrm_l) __strxfrm_l;
11 
main(void)12 int main(void) {
13   char q[100];
14   locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0);
15   size_t n = __strxfrm_l(q, "qwerty", sizeof(q), loc);
16   assert(n < sizeof(q));
17   __msan_check_mem_is_initialized(q, n + 1);
18   return 0;
19 }
20