diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2015-03-03 22:15:35 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2015-03-03 22:15:35 +0000 |
commit | 6cb698a584b64e3d9b4df022fcb70504b0c33348 (patch) | |
tree | ae0ac037ed5035426b792f7cfc424328ccd030f9 /include/clang/Basic/Sanitizers.def | |
parent | b79099a8d86c8420bba56e01abbf27baa6c03639 (diff) | |
download | clang-6cb698a584b64e3d9b4df022fcb70504b0c33348.tar.gz |
[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
Diffstat (limited to 'include/clang/Basic/Sanitizers.def')
-rw-r--r-- | include/clang/Basic/Sanitizers.def | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/clang/Basic/Sanitizers.def b/include/clang/Basic/Sanitizers.def index 1595c753cb..cded80a9cf 100644 --- a/include/clang/Basic/Sanitizers.def +++ b/include/clang/Basic/Sanitizers.def @@ -64,7 +64,9 @@ SANITIZER("null", Null) SANITIZER("object-size", ObjectSize) SANITIZER("return", Return) SANITIZER("returns-nonnull-attribute", ReturnsNonnullAttribute) -SANITIZER("shift", Shift) +SANITIZER("shift-base", ShiftBase) +SANITIZER("shift-exponent", ShiftExponent) +SANITIZER_GROUP("shift", Shift, ShiftBase | ShiftExponent) SANITIZER("signed-integer-overflow", SignedIntegerOverflow) SANITIZER("unreachable", Unreachable) SANITIZER("vla-bound", VLABound) |