1 /* 2 pr49161.c from the execute part of the gcc torture tests. 3 */ 4 5 #include <testfwk.h> 6 7 #ifdef __SDCC 8 #pragma std_c99 9 #endif 10 11 /* PR tree-optimization/49161 */ 12 13 int c; 14 15 void bar(int x)16bar (int x) 17 { 18 if (x != c++) 19 ASSERT (0); 20 } 21 22 void foo(int x)23foo (int x) 24 { 25 switch (x) 26 { 27 case 3: goto l1; 28 case 4: goto l2; 29 case 6: goto l3; 30 default: return; 31 } 32 l1: 33 goto l4; 34 l2: 35 goto l4; 36 l3: 37 bar (-1); 38 l4: 39 bar (0); 40 if (x != 4) 41 bar (1); 42 if (x != 3) 43 bar (-1); 44 bar (2); 45 } 46 47 void testTortureExecute(void)48testTortureExecute (void) 49 { 50 #if !(defined (__GNUC__) && defined (__GNUC_MINOR__) && (__GNUC__ < 5)) 51 foo (3); 52 if (c != 3) 53 ASSERT (0); 54 return; 55 #endif 56 } 57 58