From e3f84f37a8858fdfc678160f51d618b25a8a0847 Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" <p.w.draper@durham.ac.uk> Date: Wed, 11 Jan 2023 11:29:43 +0000 Subject: [PATCH] Issues found by sanitizer --- src/cell_unskip.c | 5 +++-- src/scheduler.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cell_unskip.c b/src/cell_unskip.c index fc6fe18892..c4a52110a0 100644 --- a/src/cell_unskip.c +++ b/src/cell_unskip.c @@ -1625,10 +1625,11 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { const int with_feedback = e->policy & engine_policy_feedback; const int with_timestep_limiter = (e->policy & engine_policy_timestep_limiter); + const int with_sinks = e->policy & engine_policy_sinks; #ifdef WITH_MPI const int with_star_formation = e->policy & engine_policy_star_formation; - if (e->policy & engine_policy_sinks) error("TODO"); + if (with_sinks) error("Cannot use sink tasks and MPI"); #endif int rebuild = 0; @@ -1929,7 +1930,7 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) { cell_activate_star_formation_tasks(c->top, s, with_feedback); cell_activate_super_spart_drifts(c->top, s); } - if (c->top->sinks.star_formation_sink != NULL) { + if (with_sinks && c->top->sinks.star_formation_sink != NULL) { cell_activate_star_formation_sink_tasks(c->top, s, with_feedback); } } diff --git a/src/scheduler.c b/src/scheduler.c index 352f470484..c210b9f207 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -2504,8 +2504,9 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) { case task_type_sub_pair: qid = t->ci->super->owner; owner = &t->ci->super->owner; - if (qid < 0 || - s->queues[qid].count > s->queues[t->cj->super->owner].count) { + if ((qid < 0) || + ((t->cj->super->owner > -1) && + (s->queues[qid].count > s->queues[t->cj->super->owner].count))) { qid = t->cj->super->owner; owner = &t->cj->super->owner; } -- GitLab