[PATCH] D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 20 10:34:58 PDT 2018


vsk added inline comments.


================
Comment at: docs/UndefinedBehaviorSanitizer.rst:159
   -  ``-fsanitize=undefined``: All of the checks listed above other than
      ``unsigned-integer-overflow`` and the ``nullability-*`` checks.
   -  ``-fsanitize=undefined-trap``: Deprecated alias of
----------------
Please add "the `implicit-cast` group of checks" to this list.


================
Comment at: docs/UndefinedBehaviorSanitizer.rst:134
+     integer promotions, as those may result in an unexpected computation
+     results, even though no overflow happens (signed or unsigned).
   -  ``-fsanitize=unreachable``: If control flow reaches an unreachable
----------------
lebedev.ri wrote:
> vsk wrote:
> > Could you make this more explicit? It would help to point out that this check does not diagnose lossy implicit integer conversions, but that the new check does. Ditto for the comment in the unsigned-integer-overflow section.
> Is this better?
Looks good.


================
Comment at: lib/CodeGen/CodeGenFunction.h:383
+  // This stack is used/maintained exclusively by the implicit cast sanitizer.
+  llvm::SmallVector<const CastExpr *, 8> CastExprStack;
+
----------------
lebedev.ri wrote:
> vsk wrote:
> > Why not 0 instead of 8, given that in the common case, this stack is unused?
> No longer relevant.
I'm referring to CastExprStack within ScalarExprEmitter, which still allocates space for 8 pointers inline.


Repository:
  rC Clang

https://reviews.llvm.org/D48958





More information about the cfe-commits mailing list