Skip to content

Error in scheduler_ranktasks()

I was compiling the code with a newer GCC and the compiler returned the following error (from a warning):

scheduler.c: In function ‘scheduler_ranktasks’:
scheduler.c:869:32: error: self-comparison always evaluates to false [-Werror=tautological-compare]
     if (tasks[tid[k - 1]].rank > tasks[tid[k - 1]].rank)

This is in the debugging code at the end of the routine and the compiler is obviously right here. That expression is useless. And it has always been like this, meaning that there is no version of the code where we checked that the ranking of tasks is correct.

If I modify this line to be what I assumed was the original intent:

#ifdef SWIFT_DEBUG_CHECKS
  /* Verify that the tasks were ranked correctly. */
  for (int k = 1; k < s->nr_tasks; k++)
    if (tasks[tid[k - 1]].rank > tasks[tid[k]].rank)
      error("Task ranking failed.");
#endif

then the code crashes at runtime with the error message "Task ranking failed". For instance using the Sod shock:

../swift -s -t 4 sodShock.yml

So it seems like we have a bug in the task ranking function or in the verification code.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information