1 /* { dg-do compile } */
2 /* { dg-options "-Wstack-usage=512" } */
3 /* { dg-require-effective-target untyped_assembly } */
4 
foo1(void)5 int foo1 (void)  /* { dg-bogus "stack usage" } */
6 {
7   char arr[16];
8   arr[0] = 1;
9   return 0;
10 }
11 
foo2(void)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.  */
foo3(void)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 
foo4(int n)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 }
36