[PATCH] D11283: runtime flag for use-after dtor and v simple runtime test
Evgeniy Stepanov
eugenis at google.com
Fri Jul 17 10:16:22 PDT 2015
eugenis added inline comments.
================
Comment at: test/msan/dtor-member.cc:9
@@ +8,3 @@
+// RUN: FileCheck %s < %t.out
+
+#include <sanitizer/msan_interface.h>
----------------
Please add run lines without (a) compiler flag and (b) runtime flag.
================
Comment at: test/msan/dtor-member.cc:22
@@ +21,3 @@
+ Simple s(5);
+ s.~Simple();
+ __msan_check_mem_is_initialized(&s, sizeof(s));
----------------
If we don't crash on the next line (in the negative test), there will be a second destructor call at the function exit, which invokes undefined behavior. Let's change the code to smth like this:
unsigned long buf[1];
assert(sizeof(Simple) <= sizeof(buf));
Simple *s = new(&buf) Simple();
s->~Simple();
http://reviews.llvm.org/D11283
More information about the cfe-commits
mailing list