Let tree_single_nonzero_warnv_p use range information
[official-gcc.git] / gcc / testsuite / gcc.dg / missing-field-init-2.c
blobc5a3f490387c8e6d199dbbc91a719aa8021da1bc
1 /* { dg-do compile } */
2 /* { dg-options "-Wmissing-field-initializers -std=c99" } */
4 struct s { int a, b, c; };
5 struct s s1 = { 1, 2, 3 };
6 struct s s2 = { 1, 2 }; /* { dg-warning "(missing initializer)|(near initialization)" } */
7 struct s s3[] = { { 1, 2 }, { 4, 5 } }; /* { dg-warning "(missing initializer)|(near initialization)" } */
8 struct s s4[] = { 1, 2, 3, 4, 5 }; /* { dg-warning "(missing initializer)|(near initialization)" } */
9 struct s s5[] = { 1, 2, 3, 4, 5, 6 };
10 /* Designated initializers produce no warning. */
11 struct s s6 = { .a = 1 }; /* { dg-bogus "missing initializer" } */
12 /* Allow zero-initializing with "= { 0 }". */
13 struct s s7 = { 0 }; /* { dg-bogus "missing initializer" } */
14 struct s s8 = { 1 }; /* { dg-warning "(missing initializer)|(near initialization)" } */