diff --git a/src/engine.c b/src/engine.c index 25b404c1dc435e4eb1f40559f244100c71142bfa..ee41d03ceffec5b401693802910a0287adce48dd 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2976,6 +2976,14 @@ void engine_maketasks(struct engine *e) { /* Split the tasks. */ scheduler_splittasks(sched); +#ifdef SWIFT_DEBUG_CHECKS + /* Verify that we are not left with invalid tasks */ + for (int i = 0; i < e->sched.nr_tasks; ++i) { + const struct task *t = &e->sched.tasks[i]; + if (t->ci == NULL && t->cj != NULL && !t->skip) error("Invalid task"); + } +#endif + /* Free the old list of cell-task links. */ if (e->links != NULL) free(e->links); e->size_links = 0; diff --git a/src/scheduler.c b/src/scheduler.c index 0032196b437f533df35286a83076bedb09712952..fce668ab7f31506ded274bc2a341a1f1ef03295f 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -935,12 +935,6 @@ struct task *scheduler_addtask(struct scheduler *s, enum task_types type, enum task_subtypes subtype, int flags, int implicit, struct cell *ci, struct cell *cj) { -#ifdef SWIFT_DEBUG_CHECKS - if (ci == NULL && cj != NULL) - error("Added a task with ci==NULL and cj!=NULL type=%s/%s", - taskID_names[type], subtaskID_names[subtype]); -#endif - /* Get the next free task. */ const int ind = atomic_inc(&s->tasks_next);