aboutsummaryrefslogtreecommitdiff
path: root/libgomp/work.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-05-27 23:27:00 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-05-27 23:27:00 +0200
commitfcfb80325f3ef08b0ee07edc42eef15298ba80ec (patch)
treedf999803c550f6cea25366948c4645056d4763e9 /libgomp/work.c
parent9467fbc0ff8c06ef8eb2e96fa399734758620a8f (diff)
downloadgcc-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/work.c')
-rw-r--r--libgomp/work.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libgomp/work.c b/libgomp/work.c
index 22adb8b..a589b8b 100644
--- a/libgomp/work.c
+++ b/libgomp/work.c
@@ -110,9 +110,12 @@ gomp_init_work_share (struct gomp_work_share *ws, size_t ordered,
if (__builtin_expect (ordered != 1, 0))
{
- ordered += nthreads * sizeof (*ws->ordered_team_ids) - 1;
- ordered = ordered + __alignof__ (long long) - 1;
- ordered &= ~(__alignof__ (long long) - 1);
+ 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)
+ o &= ~(__alignof__ (long long) - 1);
+ ordered += o - 1;
}
else
ordered = nthreads * sizeof (*ws->ordered_team_ids);