4 ms·
If you want to do something about it look into UBSan. Turn vague concerns into bugs, and then into commits :). https://clang.llvm.org/docs/UndefinedBehaviorSan
by icandoit 6y ago
If you want to do something about it look into UBSan. Turn vague concerns into bugs, and then into commits :).
https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
UndefinedBehaviorSanitizer (UBSan) is a fast undefined behavior detector. UBSan modifies the program at compile-time to catch various kinds of undefined behavior during program execution, for example:
- Using misaligned or null pointer
- Signed integer overflow
- Conversion to, from, or between floating-point types which would overflow the destination
GCC has similar features.
- cozzyd 6y agoUnfortunately, ubsan is not implemented on all targets, as I just found out a few seconds ago trying to enable it on my arm-none-eabi project. (I suppose technically I just need to implement all of the stubs to hard fault or something... why doesn't gcc do that for me?).
- adrianN 6y agoUBSan is awesome, but you need an awesome test suite to really unlock its power.
- rurban 6y agoIf you are too lazy to write tests, either formally verify it (cbmc or satabs) or fuzz it. Libfuzzer works great finding ubsan and asan bugs fast.
- pjmlp 6y ago> UBSan modifies the program at compile-time to catch various kinds of undefined behavior during program execution Which makes it unusable with binary libraries.