1 /* { dg-do compile } */
2 /* { dg-require-effective-target naked_functions } */
3 /* { dg-options "-O0" } */
4 
5 __attribute__((naked))
foo1()6 void foo1 ()
7 {
8   int aa = 0;
9   int ab = {0};
10 }
11 
12 __attribute__((naked))
foo2()13 void foo2() {
14   char aa [ ] = {}; /* { dg-error "cannot allocate stack for variable" } */
15   char ab [1] = {};
16   char ac [2] = {}; /* { dg-error "cannot allocate stack for variable" } */
17   char ad [3] = {}; /* { dg-error "cannot allocate stack for variable" } */
18 }
19 
20 __attribute__((naked))
foo3()21 void foo3() {
22   char aa [1] = {0};
23   char ab [2] = {0}; /* { dg-error "cannot allocate stack for variable" } */
24   char ac [3] = {0}; /* { dg-error "cannot allocate stack for variable" } */
25   char ad [4] = {0}; /* { dg-error "cannot allocate stack for variable" } */
26 }
27 
28 __attribute__((naked))
foo4()29 void foo4() {
30   char aa [2] = {0,0}; /* { dg-error "cannot allocate stack for variable" } */
31 }
32 __attribute__((naked))
foo5()33 void foo5() {
34   char aa [3] = {0,0,0}; /* { dg-error "cannot allocate stack for variable" } */
35 }
36 
37 __attribute__((naked))
foo6()38 void foo6() {
39   char aa [4] = {0,0,0,0}; /* { dg-error "cannot allocate stack for variable" } */
40 }
41