1*f4a2713aSLionel Sambuc // Header for PCH test stmts.c 2*f4a2713aSLionel Sambuc f0(int x)3*f4a2713aSLionel Sambucvoid f0(int x) { 4*f4a2713aSLionel Sambuc // NullStmt 5*f4a2713aSLionel Sambuc ; 6*f4a2713aSLionel Sambuc // IfStmt 7*f4a2713aSLionel Sambuc if (x) { 8*f4a2713aSLionel Sambuc } else if (x + 1) { 9*f4a2713aSLionel Sambuc } 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc switch (x) { 12*f4a2713aSLionel Sambuc case 0: 13*f4a2713aSLionel Sambuc x = 17; 14*f4a2713aSLionel Sambuc break; 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc case 1: 17*f4a2713aSLionel Sambuc break; 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc default: 20*f4a2713aSLionel Sambuc switch (x >> 1) { 21*f4a2713aSLionel Sambuc case 7: 22*f4a2713aSLionel Sambuc // fall through 23*f4a2713aSLionel Sambuc case 9: 24*f4a2713aSLionel Sambuc break; 25*f4a2713aSLionel Sambuc } 26*f4a2713aSLionel Sambuc x += 2; 27*f4a2713aSLionel Sambuc break; 28*f4a2713aSLionel Sambuc } 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc while (x > 20) { 31*f4a2713aSLionel Sambuc if (x > 30) { 32*f4a2713aSLionel Sambuc --x; 33*f4a2713aSLionel Sambuc continue; 34*f4a2713aSLionel Sambuc } else if (x < 5) 35*f4a2713aSLionel Sambuc break; 36*f4a2713aSLionel Sambuc else 37*f4a2713aSLionel Sambuc goto done; 38*f4a2713aSLionel Sambuc } 39*f4a2713aSLionel Sambuc 40*f4a2713aSLionel Sambuc do { 41*f4a2713aSLionel Sambuc x++; 42*f4a2713aSLionel Sambuc } while (x < 10); 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc almost_done: 45*f4a2713aSLionel Sambuc for (int y = x; y < 20; ++y) { 46*f4a2713aSLionel Sambuc if (x + y == 12) 47*f4a2713aSLionel Sambuc return; 48*f4a2713aSLionel Sambuc else if (x - y == 7) 49*f4a2713aSLionel Sambuc goto almost_done; 50*f4a2713aSLionel Sambuc } 51*f4a2713aSLionel Sambuc 52*f4a2713aSLionel Sambuc done: 53*f4a2713aSLionel Sambuc x = x + 2; 54*f4a2713aSLionel Sambuc 55*f4a2713aSLionel Sambuc int z = x, *y, j = 5; 56*f4a2713aSLionel Sambuc } 57*f4a2713aSLionel Sambuc f1(int x)58*f4a2713aSLionel Sambucint f1(int x) { 59*f4a2713aSLionel Sambuc switch (x) { 60*f4a2713aSLionel Sambuc case 17: 61*f4a2713aSLionel Sambuc return 12; 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel Sambuc default: 64*f4a2713aSLionel Sambuc break; 65*f4a2713aSLionel Sambuc } 66*f4a2713aSLionel Sambuc 67*f4a2713aSLionel Sambuc // variable-length array 68*f4a2713aSLionel Sambuc int array[x * 17 + 3]; 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc return x*2; 71*f4a2713aSLionel Sambuc } 72*f4a2713aSLionel Sambuc what_is_my_name(void)73*f4a2713aSLionel Sambucconst char* what_is_my_name(void) { return __func__; } 74*f4a2713aSLionel Sambuc computed_goto(int x)75*f4a2713aSLionel Sambucint computed_goto(int x) { 76*f4a2713aSLionel Sambuc start: 77*f4a2713aSLionel Sambuc x = x << 1; 78*f4a2713aSLionel Sambuc void *location = &&start; 79*f4a2713aSLionel Sambuc 80*f4a2713aSLionel Sambuc if (x > 17) 81*f4a2713aSLionel Sambuc location = &&done; 82*f4a2713aSLionel Sambuc 83*f4a2713aSLionel Sambuc while (x > 12) { 84*f4a2713aSLionel Sambuc --x; 85*f4a2713aSLionel Sambuc if (x == 15) 86*f4a2713aSLionel Sambuc goto *location; 87*f4a2713aSLionel Sambuc } 88*f4a2713aSLionel Sambuc 89*f4a2713aSLionel Sambuc done: 90*f4a2713aSLionel Sambuc return 5; 91*f4a2713aSLionel Sambuc } 92*f4a2713aSLionel Sambuc 93*f4a2713aSLionel Sambuc #define maxint(a,b) ({int _a = (a), _b = (b); _a > _b ? _a : _b; }) weird_max(int x,int y)94*f4a2713aSLionel Sambucint weird_max(int x, int y) { 95*f4a2713aSLionel Sambuc return maxint(++x, --y); 96*f4a2713aSLionel Sambuc } 97