[PATCH] D32412: analyze all kinds of expressions for integer overflow

Nick Lewycky via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 28 18:15:33 PDT 2017


nlewycky added a comment.

> If we're now catching integer overflow in more cases, please add some relevant testcases.

Both more and fewer. More because we no longer have a whitelist of three kinds of expressions that we recurse into. Fewer because we no longer call IgnoreParenCasts() on the full-expression so "(void)(4608 * 1024 * 1024);" used to get a warning but now doesn't. The plan to fix this is a patch to call EvaluateIgnoredValue on non-literal types, which will get us that warning back.

I've added two cases to test/Sema/integer-overflow.c and changed one to demonstrate this patch. It previously had an additional + on it just to trigger the int overflow checking.

> I have an unsubstantiated performance concern: we've seen this overflow checking having a visible effect on compile times in LNT before

I haven't observed slowdown like I did with my previous attempt at this change in https://reviews.llvm.org/D31839, but yes we may need to back this patch out if it causes problems.


https://reviews.llvm.org/D32412





More information about the cfe-commits mailing list