<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Oct 24, 2013 at 2:16 PM, John Regehr <span dir="ltr"><<a href="mailto:regehr@cs.utah.edu" target="_blank" class="cremed">regehr@cs.utah.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":30f" style="overflow:hidden">one way to help resolve the issue would be to stress-test a few<br>
large applications compiled with integer undefined behavior checking and<br>
then take a close look at the resulting signed left-shift UBs.</div></blockquote></div><br>FWIW, sorry I wasn't more explicit, I'm saying we have done this on at least a few applications. Unfortunately, at the moment I just have my memory. I can dig up data if it is necessary.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">My memory is that LLVM was a mixture of two patterns followed by a long tail of other stuff, and I have data that shows several large C++ applications at Google had similar distributions.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">1) Code that *wanted* to be unsigned, but forgot that a literal '42' was signed. We changed it to '42u' which was preferable on all fronts.<br></div>
<div class="gmail_extra">2) Bugs</div><div class="gmail_extra">3) Everything else</div><div class="gmail_extra"><br></div><div class="gmail_extra">You can call #1 false positives, but the code reviewers for the patches to projects based on this have consistently felt that this was a useful fix/clarification of their intent in the code.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">We did consider some examples of #3 to be unfortunate (requiring a cast, etc), but they were quite rare relatively.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
The other thing to consider is that the bugs we found in #2 were serious, hard to find bugs that had gone unnoticed for a long time. Our developers were very willing to pay the price of finding those bugs.</div></div>