1 /* { dg-do compile } */ 2 /* { dg-options "-O2 -fdump-tree-thread1-details -fdump-tree-thread2-details" } */ 3 /* { dg-final { scan-tree-dump-times "FSM" 3 "thread1" } } */ 4 /* { dg-final { scan-tree-dump-times "FSM" 5 "thread2" } } */ 5 6 int sum0, sum1, sum2, sum3; foo(char * s,char ** ret)7int foo (char *s, char **ret) 8 { 9 int state=0; 10 char c; 11 12 for (; *s && state != 4; s++) 13 { 14 c = *s; 15 if (c == '*') 16 { 17 s++; 18 break; 19 } 20 switch (state) 21 { 22 case 0: 23 if (c == '+') 24 state = 1; 25 else if (c != '-') 26 sum0+=c; 27 break; 28 case 1: 29 if (c == '+') 30 state = 2; 31 else if (c == '-') 32 state = 0; 33 else 34 sum1+=c; 35 break; 36 default: 37 break; 38 } 39 40 } 41 *ret = s; 42 return state; 43 } 44