PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / pr44838.c
blob61608ed0b7121e294cc602597b9c786d1baef771
1 /* PR rtl-optimization/44838 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -funroll-loops" } */
5 extern void abort ();
7 void
8 foo (int *a, int n)
10 int *lasta = a + n;
11 for (; a != lasta; a++)
13 *a *= 2;
14 a[1] = a[-1] + a[-2];
18 int a[16];
19 int ref[16] = { 0, 1, 4, 2, 10, 12, 24, 44,
20 72, 136, 232, 416, 736, 1296, 2304, 2032 };
22 int
23 main ()
25 int i;
26 for (i = 0; i < 16; i++)
27 a[i] = i;
28 foo (a + 2, 16 - 3);
29 for (i = 0; i < 16; i++)
30 if (ref[i] != a[i])
31 abort ();
32 return 0;