[PATCH] D48959: [compiler-rt][ubsan] Implicit Cast Sanitizer - integer truncation - compiler-rt part

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 10 12:59:38 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/ubsan/ubsan_checks.inc:33
 UBSAN_CHECK(InvalidBuiltin, "invalid-builtin-use", "invalid-builtin-use")
+UBSAN_CHECK(ImplicitCast, "implicit-cast", "implicit-cast")
+UBSAN_CHECK(ImplicitIntegerTruncation, "implicit-integer-truncation",
----------------
lebedev.ri wrote:
> If there is no this grouping, then i would need to default to `GenericUB`,
> and that is not really correct, since this is not really UB.
> What harm is in having this check-that-is-just-a-group in here?
Humm, after digging a bit more, i have finally noticed that i wasn't missing some extra macro,
but indeed, there was simply no grouping for these checks in blacklists...
Dropped.


================
Comment at: lib/ubsan/ubsan_handlers.cc:470
+
+  // FIXME: is it possible to dump the values as hex with fixed width?
+
----------------
filcab wrote:
> Not ATM.
That is basically why it is a FIXME.


================
Comment at: test/ubsan/TestCases/ImplicitCast/integer-truncation.cpp:34
+// CHECK: {{.*}}integer-truncation.cpp:[[@LINE-1]]:15: runtime error: implicit cast from type 'int' of value 256 (32-bit, signed) to type 'int8_t' (aka 'signed char') changed the value to 0 (8-bit, signed)
+  uint8_t t4 = 257;
+// CHECK: {{.*}}integer-truncation.cpp:[[@LINE-1]]:16: runtime error: implicit cast from type 'int' of value 257 (32-bit, signed) to type 'uint8_t' (aka 'unsigned char') changed the value to 1 (8-bit, unsigned)
----------------
filcab wrote:
> Unsure we need the 257 when we already had 256 (since what happens is the same thing).
Consistency?


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D48959





More information about the llvm-commits mailing list