1 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
2 // RUN: FileCheck %s < %t.out
3 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
4 // RUN: FileCheck %s < %t.out
6 // This test relies on realloc from 100 to 101 being done in-place.
9 int main(int argc
, char **argv
) {
10 char *p
= (char *)malloc(100);
11 p
= (char *)realloc(p
, 101);
15 // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
16 // CHECK: {{#0 0x.* in main .*realloc-origin.cpp:}}[[@LINE-2]]
18 // CHECK: Uninitialized value was created by a heap allocation
19 // CHECK: {{#0 0x.* in .*realloc}}
20 // CHECK: {{#1 0x.* in main .*realloc-origin.cpp:}}[[@LINE-9]]