Musashi icon indicating copy to clipboard operation
Musashi copied to clipboard

Undefined behaviour

Open dirkwhoffmann opened this issue 6 years ago • 0 comments

Under some circumstances, Musashi uses too large bit-shift values. This results in undefined behaviour.

This is what the UndefinedBehaviorSanitizer (which is part of clang) reports:

Bildschirmfoto 2020-01-10 um 18 33 03 Bildschirmfoto 2020-01-10 um 18 33 39 Bildschirmfoto 2020-01-10 um 18 34 27

The problem with undefined behaviour shouldn't be underestimated, because some modern compilers (such as clang) make use of it to aggressively optimise code. Code with undefined behaviour can behave differently when compiled with "clang -O0" or "clang -O1", respectively (even on the same machine).

dirkwhoffmann avatar Jan 10 '20 17:01 dirkwhoffmann