1 // RUN: %clangxx_msan %s -O0 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && %run %t >%t.out 2>&1
2 // RUN: %clangxx_msan %s -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && %run %t >%t.out 2>&1
3 // RUN: %clangxx_msan %s -O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && %run %t >%t.out 2>&1
5 #include <sanitizer/msan_interface.h>
14 struct Derived
: public Base
{
21 Derived
*d
= new Derived();
24 // Verify that local pointer is unpoisoned, and that the object's
26 assert(__msan_test_shadow(&d
, sizeof(d
)) == -1);
27 assert(__msan_test_shadow(&d
->x
, sizeof(d
->x
)) != -1);
28 assert(__msan_test_shadow(&d
->y
, sizeof(d
->y
)) != -1);
30 Base
*b
= new Derived();
33 // Verify that local pointer is unpoisoned, and that the object's
35 assert(__msan_test_shadow(&b
, sizeof(b
)) == -1);
36 assert(__msan_test_shadow(&b
->x
, sizeof(b
->x
)) != -1);