From f485c3ccbdc143d1e36b5463f5dd78b9b6ee27e8 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Fri, 2 Mar 2012 10:42:10 +0000 Subject: [PATCH] [asan] Add a negative test for memcpy of long double. llvm-svn: 151888 --- compiler-rt/lib/asan/tests/asan_test.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler-rt/lib/asan/tests/asan_test.cc b/compiler-rt/lib/asan/tests/asan_test.cc index 7a3819858850..b518d43a0b51 100644 --- a/compiler-rt/lib/asan/tests/asan_test.cc +++ b/compiler-rt/lib/asan/tests/asan_test.cc @@ -1944,6 +1944,14 @@ TEST(AddressSanitizerMac, CFStringCreateCopy) { #endif // __APPLE__ +// Test that instrumentation of stack allocations takes into account +// AllocSize of a type, and not its StoreSize (16 vs 10 bytes for long double). +// See http://llvm.org/bugs/show_bug.cgi?id=12047 for more details. +TEST(AddressSanitizer, LongDoubleNegativeTest) { + long double a, b; + memcpy(Ident(&a), Ident(&b), sizeof(long double)); +}; + int main(int argc, char **argv) { progname = argv[0]; testing::GTEST_FLAG(death_test_style) = "threadsafe";