[PATCH] D29369: [ubsan] Omit superflous overflow checks for promoted arithmetic (PR20193)

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 1 10:36:06 PST 2017


efriedma added inline comments.


================
Comment at: lib/CodeGen/CGExprScalar.cpp:72
+  if (const auto *UO = dyn_cast<UnaryOperator>(Op.E))
+    return IsPromotedInteger(UO->getSubExpr());
+
----------------
Checking isPromotableIntegerType doesn't work the way you want it to; types can be "promoted" without actually widening them.  For example, enum types are promotable, and in C++ wchar_t is promotable.


https://reviews.llvm.org/D29369





More information about the cfe-commits mailing list