http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57813
Daniel Oertwig <daniel.oertwig at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID |--- --- Comment #4 from Daniel Oertwig <daniel.oertwig at gmail dot com> --- Task * Task_getNextReady() { uint8_t priority; if (taskInfo.ready[0]) priority = 0; else if (taskInfo.ready[1]) priority = 1; else if (taskInfo.ready[2]) priority = 2; else if (taskInfo.ready[3]) priority = 3; else if (taskInfo.ready[4]) priority = 4; else if (taskInfo.ready[5]) priority = 5; else if (taskInfo.ready[6]) priority = 6; else priority = 7; time_t delay = Task_enforceTimeslice(priority); Task * next = taskInfo.ready[priority]; next->wakeTime = delay; return next; } This code solves the issue, using the correct value of the global variable. Please tell me if I am wrong, but I think this code should be equivalent to the original code. (Task_enforceTimeslice is not declared as pure, I checked just to be sure)