[PATCH] D30729: [ubsan] Skip range checks for width-limited values

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 8 09:11:18 PST 2017


vsk added a comment.

In https://reviews.llvm.org/D30729#695463, @arphaman wrote:

> You should also add a test for `enum E : unsigned`.


Ubsan doesn't try to infer the range of enums with a fixed, underlying type. I'll add a test case to make sure we don't insert a check.



================
Comment at: test/CodeGenCXX/ubsan-bitfields.cpp:39
+  // CHECK-NOT: !nosanitize
+  return s->e3;
+}
----------------
filcab wrote:
> Add checks/check-nots to make sure the thing you don't want isn't emitted, not just `!nosanitize`
> The checks help document what you're trying to get in each test case.
> Here I'd prefer to have a `CHECK-NOT: __ubsan_handle_load_invalid_value` than a check-not for `!nosanitize`, since checking for the handler call is more explicit.
> 
Good point, I will update the patch shortly.


https://reviews.llvm.org/D30729





More information about the cfe-commits mailing list