3 /* Make sure destructors are called for class variables bound
4 in intervening code. */
6 static int f1count[3], f2count[3];
7 static int g1count[3], g2count[3];
9 static int ccount[3], dcount[3];
14 C (int nn) { n = nn; ccount[n]++; }
15 ~C () { dcount[n]++; n = 0; }
19 extern void abort (void);
21 extern "C" void abort (void);
24 int f1 (int depth, int iter)
30 int f2 (int depth, int iter)
36 int g1 (int depth, int iter)
42 int g2 (int depth, int iter)
48 void s1 (int a1, int a2, int a3)
52 #pragma omp for collapse(3)
53 for (i = 0; i < a1; i++)
59 for (j = 0; j < a2; j++)
65 for (k = 0; k < a3; k++)
104 /* All intervening code at the same depth must be executed the same
106 if (f1count[0] != f2count[0]) abort ();
107 if (f1count[1] != f2count[1]) abort ();
108 if (f1count[2] != f2count[2]) abort ();
109 if (g1count[0] != f1count[0]) abort ();
110 if (g2count[0] != f1count[0]) abort ();
111 if (g1count[1] != f1count[1]) abort ();
112 if (g2count[1] != f1count[1]) abort ();
113 if (g1count[2] != f1count[2]) abort ();
114 if (g2count[2] != f1count[2]) abort ();
116 /* Intervening code must be executed at least as many times as the loop
118 if (f1count[0] < 3) abort ();
119 if (f1count[1] < 3 * 4) abort ();
121 /* Intervening code must not be executed more times than the number
122 of logical iterations. */
123 if (f1count[0] > 3 * 4 * 5) abort ();
124 if (f1count[1] > 3 * 4 * 5) abort ();
126 /* Check that the innermost loop body is executed exactly the number
127 of logical iterations expected. */
128 if (f1count[2] != 3 * 4 * 5) abort ();
130 /* Check that each class object declared in intervening code was
131 constructed and destructed an equal number of times. */
132 if (ccount[0] != dcount[0]) abort ();
133 if (ccount[1] != dcount[1]) abort ();
134 if (ccount[2] != dcount[2]) abort ();