aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/opt/stack2.C
blob: 8468e1a68832f3dd1831506cae836778fec224ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// PR c++/51060
// { dg-options "-Os -Wframe-larger-than=2000 -Werror" }

// Shows a problem of not re-using stack space:
// Compile as: g++ -c test_stack_reuse.cpp -o /dev/null -Wframe-larger-than=2048 -Werror -Os
// Result: warning: the frame size of 10240 bytes is larger than 2048 bytes [-Wframe-larger-than=]
//

struct StackObject
{
  StackObject();
  char buffer[1024];
};

void Test()
{
#define TEST_SUB() \
  StackObject();

#define TEST() \
	TEST_SUB() \
	TEST_SUB() \
	TEST_SUB() \
	TEST_SUB() \
	TEST_SUB() \
	TEST_SUB() \
	TEST_SUB() \
	TEST_SUB() \
	TEST_SUB() \
	TEST_SUB()

  TEST()
}