Dave Korn wrote:
However as I mentioned, the behaviour of unsigned integers in overflow conditions IS well defined, and so if the compiler produced code that behaved differently at -O0 and -O2 when you took that example code and changed "int" to "unsigned int" everywhere, that *would* be a genuine compiler bug, and one that would need fixing.
Indeed! In fact I would not even use the term overflow in conjunction with unsigned, the unsigned semantics is modular, and there is no overlow :-)