Re:Impact of Undefined Behavior on Performance
by cobbal on Friday July 09, 2021 @03:10AM
(#27781185)
The problem is that “radical” is in the eye of the beholder. If a language is so poorly specified that developers and the specification don’t agree on the meaning of a program, that leaves optimizers in an unwinnable situation.
Pretending that integer overflows don't happen because of undef behaviour is... Funny. Integer overflow do happen a lot, both with signed and unsigned ints. Compilers should only apply radical optimisations in this situation if they can prove an overflow will never happen. Otherwise, they should not touch the loop.
EDIT: typos, rephrasing for clarity