Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-interchange-3.c
blobb239230157da725bd039734145790d9e8bf4320b
1 /* { dg-do run } */
2 /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */
3 /* { dg-skip-if "too big stack" { avr-*-* visium-*-* } } */
5 /* Copied from graphite/interchange-6.c */
7 #define DEBUG 0
8 #if DEBUG
9 #include <stdio.h>
10 #endif
12 #define N 100
13 #define M 200
15 static int __attribute__((noinline))
16 foo (int A[N][M])
18 int i, j;
20 /* This loop should be interchanged. */
21 for(j = 0; j < M; j++)
22 for(i = 0; i < N; i++)
23 A[i][j] = A[i][j] + A[i][j];
25 return A[0][0] + A[N-1][M-1];
28 extern void abort ();
30 static void __attribute__((noinline))
31 init (int *arr, int i)
33 int j;
35 for (j = 0; j < M; j++)
36 arr[j] = 2;
39 int
40 main (void)
42 int A[N][M];
43 int i, j, res;
45 for (i = 0; i < N; i++)
46 init (A[i], i);
48 res = foo (A);
50 #if DEBUG
51 fprintf (stderr, "res = %d \n", res);
52 #endif
54 if (res != 8)
55 abort ();
57 return 0;
60 /* { dg-final { scan-tree-dump-times "Loop_pair<outer:., inner:.> is interchanged" 1 "linterchange"} } */