<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Oct 14, 2014, at 1:38 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Oct 14, 2014 at 1:29 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Tue, Oct 14, 2014 at 11:38 AM, jahanian <span dir="ltr"><<a href="mailto:fjahanian@apple.com" target="_blank">fjahanian@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Currently we do not warn Integer overflow in presence of casts; as in:<div><div style="margin:0px;font-size:11px;font-family:Menlo">unsigned long long l = 65536 * 65536;</div></div><div style="margin:0px;font-size:11px;font-family:Menlo"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo">This small patch fixes it:</div></div></blockquote><div><br></div></div></div><div>lgtm, thanks!</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div style="margin:0px;font-size:11px;font-family:Menlo">Also, is there a reason we do not warn on overflow for unsigned; as in:</div><div style="margin:0px;font-size:11px;font-family:Menlo"><div style="margin:0px">unsigned long long l2 = 65536 * (unsigned)65536;</div><div style="margin:0px">Even though resulting constant is the unexpected 0.</div></div></div></blockquote><div><br></div><div>The result is defined to be zero. We could warn, but false positives are likely.</div></div></div></div></blockquote><div><br></div><div>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.</div></div></div></div>
</blockquote><br></div><div>Good idea, and this is something that one of users expected. Will investigate.</div><div>- Fariborz</div><div><br></div><br></body></html>