sw_unsigned.c (562B)
1 /* A switch on an unsigned selector with a large case value above INT_MAX, so 2 * the dispatch must compare without sign extension. This exercises the unsigned 3 * compare path feeding the switch. volatile selector defeats folding. The 4 * value 0x80000001u selects the case returning 42. Exit code 42. */ 5 int sel(unsigned x) { 6 switch (x) { 7 case 0u: 8 return 10; 9 case 0x80000001u: 10 return 42; 11 case 0xFFFFFFFFu: 12 return 12; 13 default: 14 return 99; 15 } 16 } 17 int test_main(void) { 18 volatile unsigned x = 0x80000001u; 19 return sel(x); 20 }