[libcxx] r296813 - Fix test failures caused by new/delete calls getting optimized away
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 2 13:16:36 PST 2017
Author: ericwf
Date: Thu Mar 2 15:16:35 2017
New Revision: 296813
URL: http://llvm.org/viewvc/llvm-project?rev=296813&view=rev
Log:
Fix test failures caused by new/delete calls getting optimized away
Modified:
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp?rev=296813&r1=296812&r2=296813&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp Thu Mar 2 15:16:35 2017
@@ -46,9 +46,11 @@ void operator delete[](void* p, const st
// selected.
struct A { ~A() {} };
+A *volatile x;
+
int main()
{
- A* x = new A[3];
+ x = new A[3];
assert(0 == delete_called);
assert(0 == delete_nothrow_called);
Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp?rev=296813&r1=296812&r2=296813&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp Thu Mar 2 15:16:35 2017
@@ -43,9 +43,11 @@ struct A
~A() {A_constructed = false;}
};
+A *volatile ap;
+
int main()
{
- A* ap = new A;
+ ap = new A;
assert(ap);
assert(A_constructed);
assert(new_called);
Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp?rev=296813&r1=296812&r2=296813&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp Thu Mar 2 15:16:35 2017
@@ -44,9 +44,11 @@ void operator delete(void* p, std::size_
std::free(p);
}
+int *volatile x;
+
int main()
{
- int *x = new int(42);
+ x = new int(42);
assert(0 == unsized_delete_called);
assert(0 == unsized_delete_nothrow_called);
assert(0 == sized_delete_called);
Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp?rev=296813&r1=296812&r2=296813&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp Thu Mar 2 15:16:35 2017
@@ -49,9 +49,11 @@ void operator delete(void* p, std::size_
std::free(p);
}
+int *volatile x;
+
int main()
{
- int *x = new int(42);
+ x = new int(42);
assert(0 == unsized_delete_called);
assert(0 == unsized_delete_nothrow_called);
assert(0 == sized_delete_called);
Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp?rev=296813&r1=296812&r2=296813&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp Thu Mar 2 15:16:35 2017
@@ -17,7 +17,7 @@
// NOTE: Only clang-3.7 and GCC 5.1 and greater support -fsized-deallocation.
// REQUIRES: fsized-deallocation
-// RUN: %build -fsized-deallocation
+// RUN: %build -fsized-deallocation -O3
// RUN: %run
#if !defined(__cpp_sized_deallocation)
More information about the cfe-commits
mailing list