Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr34415.c
blobb278748765b7ca7dca9da69e04e050a56887f4b6
1 /*
2 pr34415.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #pragma disable_warning 84
10 #endif
12 const char *
13 foo (const char *p)
15 const char *end;
16 int len = 1;
17 for (;;)
19 int c = *p;
20 c = (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c);
21 if (c == 'B')
22 end = p;
23 else if (c == 'A')
25 end = p;
27 p++;
28 while (*p == '+');
30 else
31 break;
32 p++;
33 len++;
35 if (len > 2 && *p == ':')
36 p = end;
37 return p;
40 void
41 testTortureExecute (void)
43 const char *input = "Bbb:";
44 ASSERT (!(foo (input) != input + 2));