3 ms·
Since compilers (and by "compilers" I mean gcc mostly) quietly break your code behind your back, you have no way of telling whether you really fixed things or n
by DanWaterworth 11y ago
Since compilers (and by "compilers" I mean gcc mostly) quietly break your code behind your back, you have no way of telling whether you really fixed things or not.
Compile your test suite with -fsanitize=undefined.
- deng 11y agoThat will catch a tiny part of undefined behavior.
- MichaelGG 11y agoWhy doesn't the compiler emit a warning for all UB it finds while compiling? Or do regular programs rely on this too much to be feasible? It must be something like that, or there'd not be much performance gains to be had by exploiting UB right?
- DanWaterworth 11y agoIt's not necessarily detectable statically.
- lmm 11y agoAny time you add two (signed) integers, that's potentially undefined behaviour.