[PATCH] D27607: [ubsan] Treat ObjC's BOOL as if its range is always {0, 1}

Francis Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 19 17:42:03 PDT 2017


fjricci added a comment.

On platforms where `BOOL` == `signed char`, is it actually undefined behavior (or is it just bad programming practice) to store a value other than 0 or 1 in your `BOOL`? I can't find any language specs suggesting that it is, and given that it's just a typedef for a `signed char`, I don't see why it would be.

If it's not actually undefined behavior, could we make it controllable via a separate fsanitize switch (like we have for unsigned integer overflow, which is also potentially bad practice but not actually undefined behavior).


Repository:
  rL LLVM

https://reviews.llvm.org/D27607





More information about the cfe-commits mailing list