http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57723
--- Comment #9 from Mikael Pettersson <mikpe at it dot uu.se> --- (In reply to Michael Matz from comment #8) > (the > argument being that an infinite loop is in itself a side-effect observable > from > outside). Exactly. > A function containing > an infinite loop could be stopped from a different thread. We have production code which does that, except the stopping (and redirection to another context) is done from a separate monitor process via ptrace(). GCC "optimizing" away infinite loops is just plain wrong, at least for ordinary systems programming languages.