Add new test to verify that the array index, limit, and stride are
[official-gcc.git] / gcc / testsuite / gcc.dg / stack-usage-2.c
blobd3c17a84d88224ce1ce2ed8e586011242be1cfef
1 /* { dg-do compile } */
2 /* { dg-options "-Wstack-usage=512" } */
4 int foo1 (void)
6 char arr[16];
7 arr[0] = 1;
8 return 0;
9 } /* { dg-bogus "stack usage" } */
11 int foo2 (void)
13 char arr[1024];
14 arr[0] = 1;
15 return 0;
16 } /* { dg-warning "stack usage is \[0-9\]* bytes" } */
18 int foo3 (void)
20 char arr[1024] __attribute__((aligned (512)));
21 arr[0] = 1;
22 /* Force dynamic realignment of argument pointer. */
23 __builtin_apply ((void (*)()) foo2, 0, 0);
24 return 0;
26 } /* { dg-warning "stack usage might be \[0-9\]* bytes" } */
28 int foo4 (int n)
30 char arr[n];
31 arr[0] = 1;
32 return 0;
33 } /* { dg-warning "stack usage might be unbounded" } */