3 ms·
This is nonsense. The optimizer makes decisions based on UB at compile-time. It should warn about this, especially when deleting code. > overwhelmingly commo
by cryptonector 8y ago
This is nonsense. The optimizer makes decisions based on UB at compile-time. It should warn about this, especially when deleting code.
> overwhelmingly common case you won't see undefined behavior.
You think so. But this actually can be a source of serious security vulnerabilities. I want at least the option to know.
- bonzini 8y agoWould you like to have a warning for every "for(i=a; i<=b; i++)" loop, where the compiler assumes the loop is not infinite? Or for every a[i++] in a loop (including a[i] with i++ in the for loop of course), where the compiler assumes it can convert the induction variable to *p++? Both of these are undefined behavior if "i" is signed and it overflows.