| 1 |
// PR c++/51060 |
| 2 |
// { dg-options "-Os -Wframe-larger-than=2000 -Werror" } |
| 3 |
|
| 4 |
// Shows a problem of not re-using stack space: |
| 5 |
// Compile as: g++ -c test_stack_reuse.cpp -o /dev/null -Wframe-larger-than=2048 -Werror -Os |
| 6 |
// Result: warning: the frame size of 10240 bytes is larger than 2048 bytes [-Wframe-larger-than=] |
| 7 |
// |
| 8 |
|
| 9 |
struct StackObject |
| 10 |
{ |
| 11 |
StackObject(); |
| 12 |
char buffer[1024]; |
| 13 |
}; |
| 14 |
|
| 15 |
void Test() |
| 16 |
{ |
| 17 |
#define TEST_SUB() \ |
| 18 |
StackObject(); |
| 19 |
|
| 20 |
#define TEST() \ |
| 21 |
TEST_SUB() \ |
| 22 |
TEST_SUB() \ |
| 23 |
TEST_SUB() \ |
| 24 |
TEST_SUB() \ |
| 25 |
TEST_SUB() \ |
| 26 |
TEST_SUB() \ |
| 27 |
TEST_SUB() \ |
| 28 |
TEST_SUB() \ |
| 29 |
TEST_SUB() \ |
| 30 |
TEST_SUB() |
| 31 |
|
| 32 |
TEST() |
| 33 |
} |