Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / gcc.c-torture / execute / 20011126-2.c
blobf6625058afb3a8b8d405d16d7258dfc46ce5c55d
1 /* Problem originally visible on ia64.
3 There is a partial redundancy of "in + 1" that makes GCSE want to
4 transform the final while loop to
6 p = in + 1;
7 tmp = p;
8 ...
9 goto start;
10 top:
11 tmp = tmp + 1;
12 start:
13 in = tmp;
14 if (in < p) goto top;
16 We miscalculate the number of loop iterations as (p - tmp) = 0
17 instead of (p - in) = 1, which results in overflow in the doloop
18 optimization. */
20 static const char *
21 test (const char *in, char *out)
23 while (1)
25 if (*in == 'a')
27 const char *p = in + 1;
28 while (*p == 'x')
29 ++p;
30 if (*p == 'b')
31 return p;
32 while (in < p)
33 *out++ = *in++;
38 int main ()
40 char out[4];
41 test ("aab", out);
42 return 0;