1 /* Test for various cases of excess initializers for empty objects: 2 bug 21873. Various versions of GCC ICE, hang or loop repeating 3 diagnostics on various of these tests. */ 4 /* Origin: Joseph Myers <joseph@codesourcery.com> */ 5 /* { dg-do compile } */ 6 /* { dg-options "" } */ 7 8 struct s0 { }; 9 struct s1 { int a; }; 10 struct s2 { int a; int b; }; 11 12 int a0[0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 13 int a1[0][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 14 int a2[0][1] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 15 int a3[1][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 16 int a4[][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 17 int a5[][0][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 18 int a6[][0][1] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 19 int a7[][1][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 20 21 struct s0 b0[0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 22 struct s0 b1[0][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 23 struct s0 b2[0][1] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 24 struct s0 b3[1][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 25 struct s0 b4[][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 26 struct s0 b5[][0][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 27 struct s0 b6[][0][1] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 28 struct s0 b7[][1][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 29 struct s0 b8[1] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 30 struct s0 b9[] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 31 32 struct s1 c0[0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 33 struct s1 c1[0][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 34 struct s1 c2[0][1] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 35 struct s1 c3[1][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 36 struct s1 c4[][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 37 struct s1 c5[][0][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 38 struct s1 c6[][0][1] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 39 struct s1 c7[][1][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 40 41 struct s2 d0[0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 42 struct s2 d1[0][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 43 struct s2 d2[0][1] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 44 struct s2 d3[1][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 45 struct s2 d4[][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 46 struct s2 d5[][0][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 47 struct s2 d6[][0][1] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 48 struct s2 d7[][1][0] = { 1, 2 }; /* { dg-warning "excess elements|near init" } */ 49