111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-Wstack-usage=512" } */
|
|
3 /* { dg-require-effective-target untyped_assembly } */
|
|
4
|
|
5 int foo1 (void) /* { dg-bogus "stack usage" } */
|
|
6 {
|
|
7 char arr[16];
|
|
8 arr[0] = 1;
|
|
9 return 0;
|
|
10 }
|
|
11
|
|
12 int foo2 (void) /* { dg-warning "stack usage is \[0-9\]* bytes" } */
|
|
13 {
|
|
14 char arr[1024];
|
|
15 arr[0] = 1;
|
|
16 return 0;
|
|
17 }
|
|
18
|
|
19 /* The actual warning depends on whether stack space is allocated dynamically
|
|
20 or statically. */
|
|
21 int foo3 (void) /* { dg-warning "stack usage (might be)|(is) \[0-9\]* bytes" } */
|
|
22 {
|
|
23 char arr[1024] __attribute__((aligned (512)));
|
|
24 arr[0] = 1;
|
|
25 /* Force dynamic realignment of argument pointer. */
|
|
26 __builtin_apply ((void (*)()) foo2, 0, 0);
|
|
27 return 0;
|
|
28 }
|
|
29
|
|
30 int foo4 (int n) /* { dg-warning "stack usage might be unbounded" } */
|
|
31 {
|
|
32 char arr[n];
|
|
33 arr[0] = 1;
|
|
34 return 0;
|
|
35 }
|