Patch to check for Integer overflow in presence of casts.

jahanian fjahanian at apple.com
Tue Oct 14 13:37:46 PDT 2014


Thanks for the review. In r219712.
- Fariborz
On Oct 14, 2014, at 1:29 PM, Reid Kleckner <rnk at google.com> wrote:

> On Tue, Oct 14, 2014 at 11:38 AM, jahanian <fjahanian at apple.com> wrote:
> Currently we do not warn Integer overflow in presence of casts; as in:
> unsigned long long l = 65536 * 65536;
> 
> This small patch fixes it:
> 
> lgtm, thanks!
> 
> Also, is there a reason we do not warn on overflow for unsigned; as in:
> unsigned long long l2 = 65536 * (unsigned)65536;
> Even though resulting constant is the unexpected 0.
> 
> The result is defined to be zero. We could warn, but false positives are likely.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141014/7bade1c7/attachment.html>


More information about the cfe-commits mailing list