http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57813
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- > (In reply to Daniel Oertwig from comment #5) > > (In reply to Andrew Pinski from comment #3) > > > taskInfo.ready[priority]->wakeTime = Task_enforceTimeslice(priority); > > > > > > This is the same as: > > > (*taskInfo.ready[priority]).wakeTime = Task_enforceTimeslice(priority); > > > > > > Which means either the compiler can read the value of > > > taskInfo.ready[priority] before or after the function call to > > > Task_enforceTimeslice because there is no sequence point between them. > > > > Shouldn't the compiler recognize that enforceTimeslice is altering the > > global variable? The GCC code that could warn about this does not look within functions being called, so GCC does not know what enforeTimeslice is doing. Implementing this would require a substantial amount of work, and the current devs have their hands pretty full. Perhaps cppcheck or clang-analyzer can detect this case, but I wouldn't be surprised if they can't.