[cfe-dev] Missing ReturnStmt?

Ted Kremenek kremenek at apple.com
Mon Feb 6 08:14:27 PST 2012


The analyzer stops analyzing a path when it hits a fail stop bug (because analyzing the rest of the path would be meaningless).  In this case, *c = b triggers a warning from the analyzer where 'c' is used uninitialized.

On Feb 6, 2012, at 1:55 AM, Zong <zong_y365 at 163.com> wrote:

>  Dear All,
> 
> I have a very simple clang analyzer checker code snippet like below,
> 
> --------------------------------------------------
> using namespace clang;
> using namespace ento;
> 
> namespace {
>   class myChecker: public Checker< check::PreStmt<Stmt> >  {
>   public:
>     void checkPreStmt(const Stmt *S, CheckerContext &Ctx) const ;
> 
>   };
> }
> 
> void myChecker::checkPreStmt(const Stmt *S, CheckerContext &Ctx) const {
>    S->dumpAll();
> }
> --------------------------------------------------
> 
> This analyzer was then fed with the test code:
> 
> int main()
> {
>   int *b;
>   int *c;
>   *c=b;
>    return 0;
> }
> 
> Why can't I observe a "ReturnStmt"? 
> If I change "*c=b" with something other (e.g., b=c), then "ReturnStmt" appears.  I just can! 't figure out the reason. Would someone please help me ? Thanks!
> 
> Best,
> Z
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120206/5e4e71fd/attachment.html>


More information about the cfe-dev mailing list