[UBSan] Split -fsanitize=shift into -fsanitize=shift-base and -fsanitize=shift-exponent.
-fsanitize=shift is now a group that includes both these checks, so exisiting users should not be affected. This change introduces two new UBSan kinds that sanitize only left-hand side and right-hand side of shift operation. In practice, invalid exponent value (negative or too large) tends to cause more portability problems, including inconsistencies between different compilers, crashes and inadequeate results on non-x86 architectures etc. That is, -fsanitize=shift-exponent failures should generally be addressed first. As a bonus, this change simplifies CodeGen implementation for emitting left shift (separate checks for base and exponent are now merged by the existing generic logic in EmitCheck()), and LLVM IR for these checks (the number of basic blocks is reduced). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231150 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- docs/UsersManual.rst 3 additions, 1 deletiondocs/UsersManual.rst
- include/clang/Basic/Sanitizers.def 3 additions, 1 deletioninclude/clang/Basic/Sanitizers.def
- lib/CodeGen/CGExprScalar.cpp 32 additions, 28 deletionslib/CodeGen/CGExprScalar.cpp
- test/CodeGen/catch-undef-behavior.c 6 additions, 9 deletionstest/CodeGen/catch-undef-behavior.c
- test/CodeGenCXX/catch-undef-behavior.cpp 4 additions, 6 deletionstest/CodeGenCXX/catch-undef-behavior.cpp
- test/CodeGenCXX/catch-undef-behavior2.cpp 1 addition, 1 deletiontest/CodeGenCXX/catch-undef-behavior2.cpp
- test/Driver/fsanitize.c 11 additions, 8 deletionstest/Driver/fsanitize.c
Loading
Please register or sign in to comment