1 /* PR tree-optimization/83337 */
2 /* { dg-do run { target int32plus } } */
3 /* { dg-options "-O2 -floop-interchange" } */
4 /* { dg-require-effective-target alloca }  */
5 /* { dg-skip-if "too big stack" { visium-*-* } } */
6 
7 /* Copied from graphite/interchange-5.c */
8 
9 #define DEBUG 0
10 #if DEBUG
11 #include <stdio.h>
12 #endif
13 
14 #define N 100
15 #define M 1111
16 
17 extern void abort ();
18 
19 static void __attribute__((noipa))
foo(int n)20 foo (int n)
21 {
22   int i, j;
23   struct S { char d[n]; int a : 3; int b : 17; int c : 12; };
24   struct S A[N][M];
25 
26   for (i = 0; i < N; i++)
27     {
28       asm volatile ("" : : "g" (&A[0][0]) : "memory");
29       for (j = 0; j < M; j++)
30 	A[i][j].b = 2;
31     }
32   asm volatile ("" : : "g" (&A[0][0]) : "memory");
33 
34   for (i = 0; i < M; i++)
35     for (j = 0; j < N; j++)
36       A[j][i].b = 5 * A[j][i].b;
37 
38   asm volatile ("" : : "g" (&A[0][0]) : "memory");
39   int res = A[0][0].b + A[N-1][M-1].b;
40 
41 #if DEBUG
42   fprintf (stderr, "res = %d \n", res);
43 #endif
44 
45   if (res != 20)
46     abort ();
47 }
48 
49 int
main(void)50 main (void)
51 {
52   foo (1);
53   foo (8);
54   return 0;
55 }
56