353-static-local-scope-collision.c (584B)
1 /* Distinct lexical scopes in one function may reuse a block-scope static 2 * identifier. Each declaration has its own object and emitted label. */ 3 static int pick(int which) 4 { 5 if (which == 0) { 6 static const int order[] = {12}; 7 return order[0]; 8 } 9 if (which == 1) { 10 static const int order[] = {7, 9, 11}; 11 return order[0]; 12 } 13 { 14 static const int order[] = {3, 5}; 15 return order[1]; 16 } 17 } 18 19 int main(void) 20 { 21 if (pick(0) != 12) return 1; 22 if (pick(1) != 7) return 2; 23 if (pick(2) != 5) return 3; 24 return 0; 25 }