sw_nested.c (625B)
1 /* A switch nested inside another switch. Each level dispatches independently; 2 * this checks that multiple dispatch sequences and their branch labels coexist 3 * and round-trip. volatile selectors defeat folding. Outer 1 -> inner 1 selects 4 * the arm returning 42. Exit code 42. */ 5 int sel(int a, int b) { 6 switch (a) { 7 case 0: 8 return 10; 9 case 1: 10 switch (b) { 11 case 0: 12 return 20; 13 case 1: 14 return 42; 15 default: 16 return 21; 17 } 18 default: 19 return 99; 20 } 21 } 22 int test_main(void) { 23 volatile int a = 1; 24 volatile int b = 1; 25 return sel(a, b); 26 }