Reducing stack usage of test
authorBen Craig <ben.craig@codeaurora.org>
Fri, 4 Mar 2016 14:25:13 +0000 (14:25 +0000)
committerBen Craig <ben.craig@codeaurora.org>
Fri, 4 Mar 2016 14:25:13 +0000 (14:25 +0000)
This test has a lot of classes with large amounts of manually inserted padding in them, presumably to prevent various optimizations. The test then creates lots of these objects on the stack. On embedded targets, this was usually enough to overflow the stack.

I moved the objects to global / namespace scope. Since the tests are each in their own namespace, there should be no cross-test conflicts.

llvm-svn: 262717

libcxxabi/test/dynamic_cast14.pass.cpp

index c929e38..8bf0ba5 100644 (file)
@@ -213,20 +213,20 @@ struct A13
     A13* getA13() {return this;}
 };
 
+A3 a3;
+A4 a4;
+A5 a5;
+A6 a6;
+A7 a7;
+A8 a8;
+A9 a9;
+A10 a10;
+A11 a11;
+A12 a12;
+A13 a13;
+
 void test()
 {
-    A3 a3;
-    A4 a4;
-    A5 a5;
-    A6 a6;
-    A7 a7;
-    A8 a8;
-    A9 a9;
-    A10 a10;
-    A11 a11;
-    A12 a12;
-    A13 a13;
-
     assert(dynamic_cast<A3*>(a3.getA1_3()) == a3.getA3());
     assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
 
@@ -934,20 +934,20 @@ struct A13
     A13* getA13() {return this;}
 };
 
+A3 a3;
+A4 a4;
+A5 a5;
+A6 a6;
+A7 a7;
+A8 a8;
+A9 a9;
+A10 a10;
+A11 a11;
+A12 a12;
+A13 a13;
+
 void test()
 {
-    A3 a3;
-    A4 a4;
-    A5 a5;
-    A6 a6;
-    A7 a7;
-    A8 a8;
-    A9 a9;
-    A10 a10;
-    A11 a11;
-    A12 a12;
-    A13 a13;
-
     assert(dynamic_cast<A3*>(a3.getA1_3()) == 0);
     assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
 
@@ -1655,20 +1655,20 @@ struct A13
     A13* getA13() {return this;}
 };
 
+A3 a3;
+A4 a4;
+A5 a5;
+A6 a6;
+A7 a7;
+A8 a8;
+A9 a9;
+A10 a10;
+A11 a11;
+A12 a12;
+A13 a13;
+
 void test()
 {
-    A3 a3;
-    A4 a4;
-    A5 a5;
-    A6 a6;
-    A7 a7;
-    A8 a8;
-    A9 a9;
-    A10 a10;
-    A11 a11;
-    A12 a12;
-    A13 a13;
-
     assert(dynamic_cast<A3*>(a3.getA1_3()) == a3.getA3());
     assert(dynamic_cast<A3*>(a3.getA2()) == 0);