1 /* { dg-do run} */
2 /* { dg-options "-O2" } */
3 
4 #define LENGTH 4
5 void abort (void);
6 unsigned
foo(unsigned char * buf,int n)7 __attribute__ ((noinline))  foo (unsigned char *buf, int n)
8 {
9  unsigned sum = 0, i = 0;
10  do {
11    sum +=(buf)[n-1];
12    /* Split the BB to test statements are correctly moved to
13       satisfy dependences.  */
14    if (n > LENGTH)
15      i++;
16    sum += buf[n-2];
17    sum += buf[n-3];
18    sum += buf[n-4];
19    n = n-4;
20  } while (n > 0);
21 
22  return sum + i;
23 }
24 
25 unsigned char a[] = {1, 1, 1, 1};
26 
main()27 int main() {
28   int sum = foo (a, LENGTH);
29   if (sum != 4)
30     abort ();
31   return 0;
32 }
33