| 1 |
/* TODO: move to ../libgomp.c-c++-common once C++ is implemented. */ |
| 2 |
/* NOTE: { target c } is unsupported with with the C compiler. */ |
| 3 |
|
| 4 |
/* { dg-do run } */ |
| 5 |
|
| 6 |
#include <omp.h> |
| 7 |
|
| 8 |
int AAA [[omp::decl(allocate,allocator(omp_low_lat_mem_alloc),align(4096))]]; |
| 9 |
|
| 10 |
#ifndef __cplusplus |
| 11 |
_Static_assert (_Alignof(AAA) == _Alignof(int), "wrong alignment"); |
| 12 |
#elif __cplusplus >= 201103L |
| 13 |
static_assert (alignof(AAA) == _Alignof(int), "wrong alignment"); |
| 14 |
#endif |
| 15 |
|
| 16 |
|
| 17 |
void test0 () |
| 18 |
{ |
| 19 |
int A1[5], B1; |
| 20 |
#pragma omp allocate(A1, B1) align(512) allocator(omp_default_mem_alloc) |
| 21 |
|
| 22 |
#ifndef __cplusplus |
| 23 |
_Static_assert (_Alignof(A1) == _Alignof(int[5]), "wrong alignment"); |
| 24 |
_Static_assert (_Alignof(B1) == _Alignof(int), "wrong alignment"); |
| 25 |
#elif __cplusplus >= 201103L |
| 26 |
static_assert (alignof(A1) == alignof(int[5]), "wrong alignment"); |
| 27 |
static_assert (alignof(B1) == alignof(int), "wrong alignment"); |
| 28 |
#endif |
| 29 |
|
| 30 |
if (((__UINTPTR_TYPE__) &A1 % 512) != 0) |
| 31 |
__builtin_abort (); |
| 32 |
if (((__UINTPTR_TYPE__) &B1 % 512) != 0) |
| 33 |
__builtin_abort (); |
| 34 |
} |
| 35 |
|
| 36 |
int main() |
| 37 |
{ |
| 38 |
static int BBB [[omp::decl(allocate,allocator(omp_low_lat_mem_alloc),align(4096))]]; |
| 39 |
|
| 40 |
#ifndef __cplusplus |
| 41 |
_Static_assert (_Alignof(AAA) == _Alignof(int), "wrong alignment"); |
| 42 |
#elif __cplusplus >= 201103L |
| 43 |
static_assert (alignof(AAA) == alignof(int), "wrong alignment"); |
| 44 |
#endif |
| 45 |
|
| 46 |
if (((__UINTPTR_TYPE__) &AAA % 4096) != 0) |
| 47 |
__builtin_abort (); |
| 48 |
if (((__UINTPTR_TYPE__) &BBB % 4096) != 0) |
| 49 |
__builtin_abort (); |
| 50 |
|
| 51 |
test0 (); |
| 52 |
|
| 53 |
return 0; |
| 54 |
} |