Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose left shift of a negative value in fdlibm
Build this unit test using x86_64-pc-linux-gnu, with "build_type=ubsan", and with these variables: UBSAN_OPTIONS ASAN_OPTIONS defined and exported as in 'gwc/.zshrc', to see: /opt/lmi/src/lmi/fdlibm_expm1.c:242:13: runtime error: left shift of negative value -2 #0 0x5584d6736063 in fdlibm_expm1 /opt/lmi/src/lmi/fdlibm_expm1.c:242 #1 0x5584d67a05e6 in test_expm1_log1p() /opt/lmi/src/lmi/math_functions_test.cpp:660 let-me-illustrate#2 0x5584d67b2b6b in test_main(int, char**) /opt/lmi/src/lmi/math_functions_test.cpp:848 let-me-illustrate#3 0x5584d67b3396 in cpp_main(int, char**) /opt/lmi/src/lmi/test_main.cpp:171 Before this change, the UB was detected, but the call stack didn't identify which of millions of loop iterations triggered it. Now the triggering example is isolated and discussed in some detail. By default, this unit test wouldn't be built with UBSan because it's named in $(excluded_unit_test_targets), but it is possible to run it manually as above.
- Loading branch information