Verify that empty std::vector is optimized away
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / alloc-10.c
blob01ae150dd870914843a90d0e407506ae259809b0
1 #include <omp.h>
2 #include <stdint.h>
3 #include <stdlib.h>
5 const omp_alloctrait_t traits[]
6 = { { omp_atk_alignment, 64 },
7 { omp_atk_sync_hint, omp_atv_serialized },
8 { omp_atk_fallback, omp_atv_null_fb } };
10 int
11 main ()
13 omp_allocator_handle_t a;
14 int *volatile p;
15 a = omp_init_allocator (omp_default_mem_space, 3, traits);
16 if (a == omp_null_allocator)
17 abort ();
18 p = (int *) omp_alloc (3072, a);
19 if ((((uintptr_t) p) % 64) != 0)
20 abort ();
21 p[0] = 1;
22 p[3071 / sizeof (int)] = 2;
23 omp_free (p, a);
24 omp_destroy_allocator (a);