Is this an useful optimization ??
Is this an useful optimization ??
Posted Apr 18, 2008 21:22 UTC (Fri) by mikov (guest, #33179)In reply to: Is this an useful optimization ?? by ibukanov
Parent article: GCC and pointer overflows
Exactly my point. It is not easy to imagine a case where this is a _desirable_ optimization.
It is either a bug, which should be warned, or it is deliberate. Either way the compiler
should not remove the code!
I imagine however that the general assumption "int + positive_value is always greater than
int" may be useful for complex loop optimizations and the like. It probably allows to
completely ignore integer overflow in cases like this "for (int i = 0; i < x; ++i ) {...}".