[PATCH] D70539: [clang][CodeGen] Implicit Conversion Sanitizer: handle increment/derement (PR44054)

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 09:16:23 PST 2019


lebedev.ri added inline comments.


================
Comment at: clang/lib/CodeGen/CGExprScalar.cpp:2422
   } else if (type->isIntegerType()) {
-    // Note that signed integer inc/dec with width less than int can't
-    // overflow because of promotion rules; we're just eliding a few steps here.
-    if (E->canOverflow() && type->isSignedIntegerOrEnumerationType()) {
+    if (CGF.SanOpts.hasOneOf(SanitizerKind::ImplicitIntegerTruncation) &&
+        type->isPromotableIntegerType()) {
----------------
lebedev.ri wrote:
> erichkeane wrote:
> > Should this be 'has' instead of 'hasOneOf'?  
> Uhm, it looks it can be `CGF.SanOpts.has(SanitizerKind::ImplicitSignedIntegerTruncation)`,
> but then i will need to add a defensive assert. `check-clang` is running..
So, this actually showed me a bug - we should also check for `ImplicitIntegerSignChange`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70539/new/

https://reviews.llvm.org/D70539





More information about the cfe-commits mailing list