@@ -113,7 +113,9 @@ gomp_init_work_share (struct gomp_work_s
size_t o = nthreads * sizeof (*ws->ordered_team_ids);
o += __alignof__ (long long) - 1;
if ((offsetof (struct gomp_work_share, inline_ordered_team_ids)
- & (__alignof__ (long long) - 1)) == 0)
+ & (__alignof__ (long long) - 1)) == 0
+ && __alignof__ (struct gomp_work_share)
+ >= __alignof__ (long long))
o &= ~(__alignof__ (long long) - 1);
ordered += o - 1;
}
@@ -270,8 +270,11 @@ GOMP_loop_start (long start, long end, l
#define INLINE_ORDERED_TEAM_IDS_OFF \
((offsetof (struct gomp_work_share, inline_ordered_team_ids) \
+ __alignof__ (long long) - 1) & ~(__alignof__ (long long) - 1))
- if (size > (sizeof (struct gomp_work_share)
- - INLINE_ORDERED_TEAM_IDS_OFF))
+ if (sizeof (struct gomp_work_share)
+ <= INLINE_ORDERED_TEAM_IDS_OFF
+ || __alignof__ (struct gomp_work_share) < __alignof__ (long long)
+ || size > (sizeof (struct gomp_work_share)
+ - INLINE_ORDERED_TEAM_IDS_OFF))
*mem
= (void *) (thr->ts.work_share->ordered_team_ids
= gomp_malloc_cleared (size));
@@ -269,8 +269,11 @@ GOMP_loop_ull_start (bool up, gomp_ull s
#define INLINE_ORDERED_TEAM_IDS_OFF \
((offsetof (struct gomp_work_share, inline_ordered_team_ids) \
+ __alignof__ (long long) - 1) & ~(__alignof__ (long long) - 1))
- if (size > (sizeof (struct gomp_work_share)
- - INLINE_ORDERED_TEAM_IDS_OFF))
+ if (sizeof (struct gomp_work_share)
+ <= INLINE_ORDERED_TEAM_IDS_OFF
+ || __alignof__ (struct gomp_work_share) < __alignof__ (long long)
+ || size > (sizeof (struct gomp_work_share)
+ - INLINE_ORDERED_TEAM_IDS_OFF))
*mem
= (void *) (thr->ts.work_share->ordered_team_ids
= gomp_malloc_cleared (size));
@@ -121,8 +121,11 @@ GOMP_sections2_start (unsigned count, ui
#define INLINE_ORDERED_TEAM_IDS_OFF \
((offsetof (struct gomp_work_share, inline_ordered_team_ids) \
+ __alignof__ (long long) - 1) & ~(__alignof__ (long long) - 1))
- if (size > (sizeof (struct gomp_work_share)
- - INLINE_ORDERED_TEAM_IDS_OFF))
+ if (sizeof (struct gomp_work_share)
+ <= INLINE_ORDERED_TEAM_IDS_OFF
+ || __alignof__ (struct gomp_work_share) < __alignof__ (long long)
+ || size > (sizeof (struct gomp_work_share)
+ - INLINE_ORDERED_TEAM_IDS_OFF))
*mem
= (void *) (thr->ts.work_share->ordered_team_ids
= gomp_malloc_cleared (size));