PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr66752-3.c
blob896c8bf7edcc728016884d1f0968b0712303d79d
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-thread1-details -fdump-tree-dce2" } */
4 extern int status, pt;
5 extern int count;
6 void
7 foo (int N, int c, int b, int *a)
9 int i, flag;
10 i = b -1;
11 flag = 1;
12 if (status && i < N && a[i] == b) {
13 N--;
14 flag = 0;
15 if (pt)
16 count++;
18 else
19 for (i = -1, flag = 1; ++i < N && flag;)
20 if (a[i] == b)
22 --N;
23 flag = 0;
24 if (i < N)
25 a[i] = a[N];
26 else
27 a[i] = 0;
28 if (pt)
29 count++;
31 if(status && flag)
32 pt--;
35 /* There are 4 FSM jump threading opportunities, all of which will be
36 realized, which will eliminate testing of FLAG, completely. */
37 /* { dg-final { scan-tree-dump-times "Registering FSM" 4 "thread1"} } */
39 /* There should be no assignments or references to FLAG, verify they're
40 eliminated as early as possible. */
41 /* { dg-final { scan-tree-dump-not "if .flag" "dce2"} } */