Set num_threads to 50 on 32-bit hppa in two libgomp loop tests
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / imperfect5.c
blob7bd4f12d472b456fe2019efa5fd2bb037820ed4d
1 /* { dg-do run } */
3 #ifndef __cplusplus
4 extern void abort (void);
5 #else
6 extern "C" void abort (void);
7 #endif
9 static int inner_loop_count = 0;
10 static int intervening_code_count = 0;
12 void
13 g (int x, int y)
15 inner_loop_count++;
18 int
19 foo (int imax, int jmax)
21 int j = 0;
23 #pragma omp for collapse(2)
24 for (int i = 0; i < imax; ++i)
26 /* All the intervening code at the same level must be executed
27 the same number of times. */
28 ++intervening_code_count;
29 for (int j = 0; j < jmax; ++j)
31 g (i, j);
33 /* This is the outer j, not the one from the inner collapsed loop. */
34 ++j;
36 return j;
39 int
40 main (void)
42 int j = foo (5, 3);
43 if (j != intervening_code_count)
44 abort ();
45 if (inner_loop_count != 5 * 3)
46 abort ();
47 if (intervening_code_count < 5 || intervening_code_count > 5 * 3)
48 abort ();