On Oct 14, 2014, at 1:38 PM, Richard Smith <[email protected]> wrote:

> On Tue, Oct 14, 2014 at 1:29 PM, Reid Kleckner <[email protected]> wrote:
> On Tue, Oct 14, 2014 at 11:38 AM, jahanian <[email protected]> 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.
> 
> If the thing that happens *immediately* after an unsigned overflow is an 
> implicit cast to a larger type (in which the computed value would have been 
> different), that might suggest that the overflow was unintended. Might be 
> worth investigating how large the false positive rate is for that case.

Good idea, and this is something that one of users expected. Will investigate.
- Fariborz


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to