[cfe-commits] r153568 - /cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp

Matthieu Monrocq matthieu.monrocq at gmail.com
Wed Mar 28 12:03:05 PDT 2012


Le 28 mars 2012 17:55, Nico Weber <thakis at chromium.org> a écrit :

> http://llvm.org/PR9952
>
> On Tue, Mar 27, 2012 at 11:54 PM, Jordan Rose <jediknil at belkadan.com>
> wrote:
> > I thought we had a PR tracking this for the analyzer or for Sema, but I
> can't find it. I definitely remember discussion about adding this feature,
> which stopped around the problem of "what makes two expressions
> suspiciously equivalent", but just because it's a difficult problem doesn't
> mean we shouldn't be working towards this warning.
> >
> >
> > On Mar 27, 2012, at 22:24, Ted Kremenek wrote:
> >
> >> Author: kremenek
> >> Date: Wed Mar 28 00:24:50 2012
> >> New Revision: 153568
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=153568&view=rev
> >> Log:
> >> Fix suspicious comparison reported by PVS-Studio!
> >>
> >> Modified:
> >>    cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
> >>
> >> Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
> >> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=153568&r1=153567&r2=153568&view=diff
> >>
> ==============================================================================
> >> --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
> >> +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Wed Mar 28
> 00:24:50 2012
> >> @@ -925,7 +925,7 @@
> >>            SM.getExpansionColumnNumber(ContaineeRBeg)) &&
> >>           (ContainerEndLine != ContaineeEndLine ||
> >>            SM.getExpansionColumnNumber(ContainerREnd) >=
> >> -           SM.getExpansionColumnNumber(ContainerREnd)));
> >> +           SM.getExpansionColumnNumber(ContaineeREnd)));
> >> }
> >>
>

Hum... Honestly, a one character difference between identifiers that are 13
characters long is rather unobvious. Took me 3 times reading the two lines
to actually spot the difference.

I think it would have been much easier to spot this error (for a human) if
the difference between the identifiers was more pronounced.

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120328/68416dfa/attachment.html>


More information about the cfe-commits mailing list