diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-05-27 23:27:00 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-05-27 23:27:00 +0200 |
commit | fcfb80325f3ef08b0ee07edc42eef15298ba80ec (patch) | |
tree | df999803c550f6cea25366948c4645056d4763e9 /libgomp/loop_ull.c | |
parent | 9467fbc0ff8c06ef8eb2e96fa399734758620a8f (diff) | |
download | gcc-fcfb80325f3ef08b0ee07edc42eef15298ba80ec.zip gcc-fcfb80325f3ef08b0ee07edc42eef15298ba80ec.tar.gz gcc-fcfb80325f3ef08b0ee07edc42eef15298ba80ec.tar.bz2 |
re PR libgomp/90641 (libgomp.c-c++-common/lastprivate-conditional-1.c etc FAIL)
PR libgomp/90641
* work.c (gomp_init_work_share): Instead of aligning final ordered
value to multiples of long long alignment, align to that the
first part (ordered team ids) and if inline_ordered_team_ids
is not on a long long alignment boundary within the structure,
use __alignof__ (long long) - 1 pad size always.
* loop.c (GOMP_loop_start): Fix *mem computation if
inline_ordered_team_ids is not aligned on long long alignment boundary
within the structure.
* loop-ull.c (GOMP_loop_ull_start): Likewise.
* sections.c (GOMP_sections2_start): Likewise.
From-SVN: r271671
Diffstat (limited to 'libgomp/loop_ull.c')
-rw-r--r-- | libgomp/loop_ull.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/libgomp/loop_ull.c b/libgomp/loop_ull.c index 502bb5e..edf1c32 100644 --- a/libgomp/loop_ull.c +++ b/libgomp/loop_ull.c @@ -266,14 +266,17 @@ GOMP_loop_ull_start (bool up, gomp_ull start, gomp_ull end, if (mem) { uintptr_t size = (uintptr_t) *mem; +#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) - - offsetof (struct gomp_work_share, - inline_ordered_team_ids))) - thr->ts.work_share->ordered_team_ids - = gomp_malloc_cleared (size); + - INLINE_ORDERED_TEAM_IDS_OFF)) + *mem + = (void *) (thr->ts.work_share->ordered_team_ids + = gomp_malloc_cleared (size)); else - memset (thr->ts.work_share->ordered_team_ids, '\0', size); - *mem = (void *) thr->ts.work_share->ordered_team_ids; + *mem = memset (((char *) thr->ts.work_share) + + INLINE_ORDERED_TEAM_IDS_OFF, '\0', size); } gomp_work_share_init_done (); } @@ -286,7 +289,18 @@ GOMP_loop_ull_start (bool up, gomp_ull start, gomp_ull end, first_reductions); } if (mem) - *mem = (void *) thr->ts.work_share->ordered_team_ids; + { + if ((offsetof (struct gomp_work_share, inline_ordered_team_ids) + & (__alignof__ (long long) - 1)) == 0) + *mem = (void *) thr->ts.work_share->ordered_team_ids; + else + { + uintptr_t p = (uintptr_t) thr->ts.work_share->ordered_team_ids; + p += __alignof__ (long long) - 1; + p &= ~(__alignof__ (long long) - 1); + *mem = (void *) p; + } + } } return ialias_call (GOMP_loop_ull_runtime_next) (istart, iend); |