1 /* { dg-do run } */
2 /* { dg-options "-O1 -ftree-loop-linear" } */
3
4 extern void abort (void);
5
6 #define K 32
7
8 int cond_array[2*K][K];
9 int a[K][K];
10 int out[K];
11 int check_result[K] = {2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
12
13 __attribute__ ((noinline)) void
foo(int c)14 foo (int c)
15 {
16 int res, i, j, k, next;
17
18 for (k = 0; k < K; k++)
19 {
20 res = 0;
21 for (j = 0; j < K; j++)
22 for (i = 0; i < K; i++)
23 {
24 next = a[i][j];
25 res = c > cond_array[i+k][j] ? next : res;
26 }
27
28 out[k] = res;
29 }
30 }
31
main()32 int main ()
33 {
34 int i, j, k;
35
36 for (j = 0; j < K; j++)
37 {
38 for (i = 0; i < 2*K; i++)
39 cond_array[i][j] = i+j;
40
41 for (i = 0; i < K; i++)
42 a[i][j] = i+2;
43 }
44
45 foo(5);
46
47 for (k = 0; k < K; k++)
48 if (out[k] != check_result[k])
49 abort ();
50
51 return 0;
52 }
53