From 04416705562841ccf30c82d02cc4904e7ac237e6 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Wed, 26 Oct 2016 14:00:15 +0200 Subject: [PATCH] c->depth should be cast to an int before appearing in atomic_cas() --- src/space.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/space.c b/src/space.c index 7565853e04..e59b18795e 100644 --- a/src/space.c +++ b/src/space.c @@ -1440,6 +1440,7 @@ void space_split_mapper(void *map_data, int num_cells, void *extra_data) { const int count = c->count; const int gcount = c->gcount; + const int depth = c->depth; int maxdepth = 0; float h_max = 0.0f; int ti_end_min = max_nr_timesteps, ti_end_max = 0; @@ -1449,8 +1450,8 @@ void space_split_mapper(void *map_data, int num_cells, void *extra_data) { struct xpart *xparts = c->xparts; /* Check the depth. */ - while (c->depth > (maxdepth = s->maxdepth)) { - atomic_cas(&s->maxdepth, maxdepth, c->depth); + while (depth > (maxdepth = s->maxdepth)) { + atomic_cas(&s->maxdepth, maxdepth, depth); } /* If the depth is too large, we have a problem and should stop. */ -- GitLab