1// RUN: %clangxx_msan -O0 %s -o %t && %run %t >%t.out 2>&1
2// FileCheck %s <%t.out
3
4#include <sanitizer/msan_interface.h>
5#include <stdio.h>
6#include <string.h>
7
8int main(int argc, char **argv) {
9 char *str;
10 sscanf(s: "#string#", format: "%ms", &str);
11 printf(format: "str = %s\n", str);
12 __msan_check_mem_is_initialized(x: str, size: strlen(s: str) + 1);
13 // CHECK: #string#
14}
15

source code of compiler-rt/test/msan/scanf-allocate.cpp