1 // RUN: %clangxx -m64 -O0 -g -xc++ %s -o %t && %run %t
2 // RUN: %clangxx -m64 -O3 -g -xc++ %s -o %t && %run %t
3 // REQUIRES: x86_64-target-arch
10 #include "sanitizer_common/sanitizer_specific.h"
12 static void run(bool flush
) {
15 fprintf(stderr
, " &buf %p, &buf_len %p\n", &buf
, &buf_len
);
16 FILE *fp
= open_memstream(&buf
, &buf_len
);
20 check_mem_is_good(&buf
, sizeof(buf
));
21 check_mem_is_good(&buf_len
, sizeof(buf_len
));
22 check_mem_is_good(buf
, buf_len
);
25 char *p
= new char[1024];
28 for (int i
= 0; i
< 100; ++i
)
34 fprintf(stderr
, " %p addr %p, len %zu\n", &buf
, buf
, buf_len
);
35 check_mem_is_good(&buf
, sizeof(buf
));
36 check_mem_is_good(&buf_len
, sizeof(buf_len
));
37 check_mem_is_good(buf
, buf_len
);\
41 check_mem_is_good(&buf
, sizeof(buf
));
42 check_mem_is_good(&buf_len
, sizeof(buf_len
));
43 check_mem_is_good(buf
, buf_len
);
49 for (int i
= 0; i
< 100; ++i
)
51 for (int i
= 0; i
< 100; ++i
)