Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr24716.c

raw
1 /* PR24716, scalar evolution returning the wrong result
2 for pdest. */
3
4 int Link[] = { -1 };
5 int W[] = { 2 };
6
7 extern void abort (void);
8
9 int f (int k, int p)
10 {
11 int pdest, j, D1361;
12 j = 0;
13 pdest = 0;
14 for (;;) {
15 if (pdest > 2)
16 do
17 j--, pdest++;
18 while (j > 2);
19
20 if (j == 1)
21 break;
22
23 while (pdest > p)
24 if (j == p)
25 pdest++;
26
27 do
28 {
29 D1361 = W[k];
30 do
31 if (D1361 != 0)
32 pdest = 1, W[k] = D1361 = 0;
33 while (p < 1);
34 } while (k > 0);
35
36 do
37 {
38 p = 0;
39 k = Link[k];
40 while (p < j)
41 if (k != -1)
42 pdest++, p++;
43 }
44 while (k != -1);
45 j = 1;
46 }
47
48 /* The correct return value should be pdest (1 in the call from main).
49 DOM3 is mistaken and propagates a 0 here. */
50 return pdest;
51 }
52
53 int main ()
54 {
55 if (!f (0, 2))
56 abort ();
57 return 0;
58 }
59