1 /* PR tree-optimization/71625 - missing strlen optimization on different
2 array initialization style
4 Verify that zero-length array initialization results in the expected
8 { dg-options "-Wall -Wno-unused-local-typedefs" } */
10 #define A(expr) typedef char A[-1 + 2 * !!(expr)];
17 const char b
[0] = { };
22 const char c
[0] = { 1 }; /* { dg-warning "excess elements" } */
27 void test_auto_empty (void)
34 void test_auto_zero_length (void)
36 const char a
[0] = { };
40 const char b
[0] = { 0 }; /* { dg-warning "excess elements" } */
50 void test_compound_zero_length (void)
52 A (sizeof (const char[]){ } == 0);
53 A (sizeof (const char[0]){ } == 0);
54 A (sizeof (const char[0]){ 0 } == 0); /* { dg-warning "excess elements" } */
55 A (sizeof (const char[0]){ 1 } == 0); /* { dg-warning "excess elements" } */
56 A (sizeof (const char[0]){ "" } == 0);
57 A (sizeof (const char[0]){ "1" } == 0); /* { dg-warning "too long" } */