-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake: Add USE_UBSAN #14001
CMake: Add USE_UBSAN #14001
Conversation
For consistency with USE_UBSAN
Does not link with
|
Figured it out |
Most of the UB found by UBSAN immediately are alignment issues. While x86(_64) is quite lenient towards these (but not in SIMD!), ARM CPUs do not like them at all (immediate crash in scalar code before ARMv7, crash in vectorized code on any ARM) |
Actually it's not true that it's insta-crash on ARMv7, those generally have no problems with scalar load/store with misalignment. ARMv5 and earlier is another story though. Still, of course, good to fix these. |
Yeah that's what I meant with "before ARMv7". MIPS also crashes (e.g. jz4770). This is not entirely benign even with CPUs that support unaligned access, because none of them support unaligned SIMD instructions. With |
Oh sorry I misread your post. But ARMv6 also handles scalar misalignment fine. Modern x86 and ARM64 actually both support misaligned SIMD load/stores, although with limitations. Only in the last few generations have x86 allowed unaligned SIMD memory operands. |
UBSAN is kept debug-only, similar to ASAN, though there is no real reason to do this as they both work just fine in release modes.