1 static int a = 1;                                       // OK
   2 static int b[2] = {1, 1};                               // OK
   3 static void c(void) {}
   4 
   5 struct A {
   6         int a;
   7         int b[2];
   8 };
   9 
  10 struct B {
  11         int c;
  12         struct A d;
  13 };
  14 
  15 static struct B d= {1, {1, {1, 1}}};                            // OK
  16 static struct B e= {a, {1, {1, 1}}};                            // KO
  17 static struct B f= {1, {a, {1, 1}}};                            // KO
  18 static struct B g= {1, {1, {a, 1}}};                            // KO
  19 static struct B h= {1, {1, {1, a}}};                            // KO
  20 static struct B i= {.c = 1, .d = {.a = 1, .b = {1, 1}}};        // OK
  21 static struct B j= {.c = a, .d = {.a = 1, .b = {1, 1}}};        // KO
  22 static struct B k= {.c = 1, .d = {.a = a, .b = {1, 1}}};        // KO
  23 static struct B l= {.c = 1, .d = {.a = 1, .b = {a, 1}}};        // KO
  24 static struct B m= {.c = 1, .d = {.a = 1, .b = {1, a}}};        // KO
  25 
  26 static int n[] = {a, 1};                                // KO
  27 static int o[] = {1, a};                                // KO
  28 static int p[] = {[0] = a, [1] = 1};                    // KO
  29 static int q[] = {[0] = 1, [1] = a};                    // KO
  30 
  31 static void r(void) {
  32         int a = 0;
  33         int b = a;              // OK
  34 }
  35 
  36 static void s(void) {
  37         int a = 1;
  38         static int b = a;       // KO
  39 }
  40 
  41 /*
  42  * check-name: constexprness static storage object initializer
  43  * check-command: sparse -Wconstexpr-not-const $file
  44  *
  45  * check-error-start
  46 constexpr-init.c:16:21: warning: non-constant initializer for static object
  47 constexpr-init.c:17:25: warning: non-constant initializer for static object
  48 constexpr-init.c:18:29: warning: non-constant initializer for static object
  49 constexpr-init.c:19:32: warning: non-constant initializer for static object
  50 constexpr-init.c:21:26: warning: non-constant initializer for static object
  51 constexpr-init.c:22:40: warning: non-constant initializer for static object
  52 constexpr-init.c:23:49: warning: non-constant initializer for static object
  53 constexpr-init.c:24:52: warning: non-constant initializer for static object
  54 constexpr-init.c:26:19: warning: non-constant initializer for static object
  55 constexpr-init.c:27:22: warning: non-constant initializer for static object
  56 constexpr-init.c:28:25: warning: non-constant initializer for static object
  57 constexpr-init.c:29:34: warning: non-constant initializer for static object
  58 constexpr-init.c:38:24: warning: non-constant initializer for static object
  59  * check-error-end
  60  */