diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2018-10-30 21:58:54 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2018-10-30 21:58:54 +0000 |
commit | 320e9af3096bf7b52d5a6fd780bab83e117989a9 (patch) | |
tree | 08a56b8d4ff58bacf5360909d61a8d245a529666 /compiler-rt/lib/ubsan | |
parent | [libcxx] Correct link to code review for P1006 (diff) | |
download | llvm-project-320e9af3096bf7b52d5a6fd780bab83e117989a9.tar.gz llvm-project-320e9af3096bf7b52d5a6fd780bab83e117989a9.tar.bz2 llvm-project-320e9af3096bf7b52d5a6fd780bab83e117989a9.zip |
[compiler-rt][ubsan] Implicit Conversion Sanitizer - integer sign change - compiler-rt part
Summary:
This is a compiler-rt part.
The clang part is D50250.
See [[ https://bugs.llvm.org/show_bug.cgi?id=21530 | PR21530 ]], https://github.com/google/sanitizers/issues/940.
Reviewers: vsk, filcab, #sanitizers
Reviewed By: filcab, #sanitizers
Subscribers: mclow.lists, srhines, kubamracek, dberris, rjmccall, rsmith, llvm-commits, regehr
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D50251
llvm-svn: 345659
Diffstat (limited to 'compiler-rt/lib/ubsan')
-rw-r--r-- | compiler-rt/lib/ubsan/ubsan_checks.inc | 6 | ||||
-rw-r--r-- | compiler-rt/lib/ubsan/ubsan_handlers.cc | 6 | ||||
-rw-r--r-- | compiler-rt/lib/ubsan/ubsan_handlers.h | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/compiler-rt/lib/ubsan/ubsan_checks.inc b/compiler-rt/lib/ubsan/ubsan_checks.inc index a0584d48e8a1..e976ea4f6ab0 100644 --- a/compiler-rt/lib/ubsan/ubsan_checks.inc +++ b/compiler-rt/lib/ubsan/ubsan_checks.inc @@ -36,6 +36,12 @@ UBSAN_CHECK(ImplicitUnsignedIntegerTruncation, UBSAN_CHECK(ImplicitSignedIntegerTruncation, "implicit-signed-integer-truncation", "implicit-signed-integer-truncation") +UBSAN_CHECK(ImplicitIntegerSignChange, + "implicit-integer-sign-change", + "implicit-integer-sign-change") +UBSAN_CHECK(ImplicitSignedIntegerTruncationOrSignChange, + "implicit-signed-integer-truncation-or-sign-change", + "implicit-signed-integer-truncation,implicit-integer-sign-change") UBSAN_CHECK(InvalidShiftBase, "invalid-shift-base", "shift-base") UBSAN_CHECK(InvalidShiftExponent, "invalid-shift-exponent", "shift-exponent") UBSAN_CHECK(OutOfBoundsIndex, "out-of-bounds-index", "bounds") diff --git a/compiler-rt/lib/ubsan/ubsan_handlers.cc b/compiler-rt/lib/ubsan/ubsan_handlers.cc index dfd7b3f847f6..bfcd16cb7cc4 100644 --- a/compiler-rt/lib/ubsan/ubsan_handlers.cc +++ b/compiler-rt/lib/ubsan/ubsan_handlers.cc @@ -481,6 +481,12 @@ static void handleImplicitConversion(ImplicitConversionData *Data, case ICCK_SignedIntegerTruncation: ET = ErrorType::ImplicitSignedIntegerTruncation; break; + case ICCK_IntegerSignChange: + ET = ErrorType::ImplicitIntegerSignChange; + break; + case ICCK_SignedIntegerTruncationOrSignChange: + ET = ErrorType::ImplicitSignedIntegerTruncationOrSignChange; + break; } if (ignoreReport(Loc, Opts, ET)) diff --git a/compiler-rt/lib/ubsan/ubsan_handlers.h b/compiler-rt/lib/ubsan/ubsan_handlers.h index 4f52f3a97c09..04405770e58b 100644 --- a/compiler-rt/lib/ubsan/ubsan_handlers.h +++ b/compiler-rt/lib/ubsan/ubsan_handlers.h @@ -128,6 +128,8 @@ enum ImplicitConversionCheckKind : unsigned char { ICCK_IntegerTruncation = 0, // Legacy, was only used by clang 7. ICCK_UnsignedIntegerTruncation = 1, ICCK_SignedIntegerTruncation = 2, + ICCK_IntegerSignChange = 3, + ICCK_SignedIntegerTruncationOrSignChange = 4, }; struct ImplicitConversionData { |