Set num_threads to 50 on 32-bit hppa in two libgomp loop tests
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / alloc-2.c
blobc5c090f26135c7b7a54e750a0e60db1b259f90ed
1 #include <omp.h>
2 #include <stdint.h>
3 #include <stdlib.h>
5 int
6 main ()
8 omp_alloctrait_t traits[3]
9 = { { omp_atk_alignment, 64 },
10 { omp_atk_fallback, omp_atv_null_fb },
11 { omp_atk_pool_size, 4096 } };
12 omp_allocator_handle_t a
13 = omp_init_allocator (omp_default_mem_space, 3, traits);
14 if (a == omp_null_allocator)
15 abort ();
17 #pragma omp parallel num_threads(4)
19 int n = omp_get_thread_num ();
20 double *volatile p, *volatile q;
21 omp_set_default_allocator ((n & 1) ? a : omp_default_mem_alloc);
22 p = (double *) omp_alloc (1696, omp_null_allocator);
23 if (p == NULL)
24 abort ();
25 p[0] = 1.0;
26 p[1695 / sizeof (double)] = 2.0;
27 #pragma omp barrier
28 omp_set_default_allocator ((n & 1) ? omp_default_mem_alloc : a);
29 q = (double *) omp_alloc (1696, omp_null_allocator);
30 if (n & 1)
32 if (q == NULL)
33 abort ();
34 q[0] = 3.0;
35 q[1695 / sizeof (double)] = 4.0;
37 else if (q != NULL)
38 abort ();
39 #pragma omp barrier
40 omp_free (p, omp_null_allocator);
41 omp_free (q, omp_null_allocator);
42 omp_set_default_allocator (omp_default_mem_alloc);
44 omp_destroy_allocator (a);
45 return 0;