1 // RUN: %clangxx_msan %s -O0 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && %run %t >%t.out 2>&1
3 // RUN: %clangxx_msan %s -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && %run %t >%t.out 2>&1
5 // RUN: %clangxx_msan %s -O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && %run %t >%t.out 2>&1
7 #include <sanitizer/msan_interface.h>
16 printf("~V %p %lu\n", &size
, sizeof(size
));
17 assert(__msan_test_shadow(&this->size
, sizeof(this->size
)) == -1);
23 Vector
<int> derived_v1
;
24 Vector
<int> derived_v2
;
35 printf("~D %p %p %p %lu\n", &derived_a
, &derived_v1
, &derived_c
, sizeof(*this));
36 assert(__msan_test_shadow(&derived_a
, sizeof(derived_a
)) == -1);
37 assert(__msan_test_shadow(&derived_v1
, sizeof(derived_v1
)) == -1);
38 assert(__msan_test_shadow(&derived_v2
, sizeof(derived_v2
)) == -1);
39 assert(__msan_test_shadow(&derived_b
, sizeof(derived_b
)) == -1);
40 assert(__msan_test_shadow(&derived_c
, sizeof(derived_c
)) == -1);
45 Derived
*d
= new Derived();
48 assert(__msan_test_shadow(&d
->derived_a
, sizeof(d
->derived_a
)) != -1);
49 assert(__msan_test_shadow(&d
->derived_v1
, sizeof(d
->derived_v1
)) != -1);
50 assert(__msan_test_shadow(&d
->derived_v2
, sizeof(d
->derived_v2
)) != -1);
51 assert(__msan_test_shadow(&d
->derived_b
, sizeof(d
->derived_b
)) != -1);
52 assert(__msan_test_shadow(&d
->derived_c
, sizeof(d
->derived_c
)) != -1);