]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/test/msan/open_memstream.cc
Imported Upstream version 1.5.0+dfsg1
[rustc.git] / src / compiler-rt / test / msan / open_memstream.cc
CommitLineData
1a4d82fc
JJ
1// RUN: %clangxx_msan -m64 -O0 -g -xc++ %s -o %t && %run %t
2// RUN: %clangxx_msan -m64 -O3 -g -xc++ %s -o %t && %run %t
3
4#include <stdio.h>
5#include <stdlib.h>
6
7int main(void) {
8 char *buf;
9 size_t buf_len = 42;
10 FILE *fp = open_memstream(&buf, &buf_len);
11 fprintf(fp, "hello");
12 fflush(fp);
13 printf("buf_len = %zu\n", buf_len);
14 for (int j = 0; j < buf_len; j++) {
15 printf("buf[%d] = %c\n", j, buf[j]);
16 }
17 return 0;
18}