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

Will Dietz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 9 09:13:40 PST 2017


dtzWill accepted this revision.
dtzWill added a comment.

I've been bitten when attempting to use existence/nature of casts in the AST to reason about the original code, but this looks like it does the right thing in all the situations I can think of.

Missing overflows because of a bugged attempt to optimize the -O0 case would be unfortunate-- has this been tested and compared on larger codes (test-suite, other projects)?

When it comes to C/C++ standards and constructs, it seems there's always some extension/language feature/flag that someone (ab)uses that you forgot all about when reasoning about these things abstractly...  so it'd be good to see this checked out before the next major release.

+1 to suggestion for a more readable name or wrapper for the common pattern of 'getUnwidenedIntegerType..hasValue()', if you get a chance.

LGTM, thanks!


https://reviews.llvm.org/D29369





More information about the cfe-commits mailing list