Fix alignment in teams-reduction.c test

The runtime will use the global kmp_critical_name as a lock and
tries to atomically store a pointer in there. This will fail
if the global is only aligned by 4 bytes, the size of one int32_t
element. Use a union to ensure the global is aligned to the size
of a pointer on the current platform.

llvm-svn: 319811
This commit is contained in:
Jonas Hahnfeld 2017-12-05 18:45:21 +00:00
parent 32ce5ca07c
commit 241d1d9e17

View File

@ -30,7 +30,12 @@ typedef struct {
static ident_t dummy_loc = {0, 2, 0, 0, ";dummyFile;dummyFunc;0;0;;"};
typedef int32_t kmp_critical_name[8];
typedef union {
// The global will be used as pointer, so we need to make sure that the
// compiler correctly aligns the global...
void *ptr;
int32_t data[8];
} kmp_critical_name;
kmp_critical_name crit;
int32_t __kmpc_global_thread_num(ident_t *);