[cfe-dev] [StaticAnalyzer]: Cant get my checker to output

Arjun Singri arjunsingri at gmail.com
Wed Sep 28 21:03:55 PDT 2011


My checker was able to output (the debug messages show up) when I changed
the IfStmt to BinaryOperator. So my checker has been registered correctly.
It is not able to deal with IfStmt for some reason.

Here is the code I am trying to analyze:

#include<stdio.h>

  int foo() { return 2; }

  int main(void)
  {
      int a = foo();
      int b = foo();

      scanf("%d", &a);

      a = a + b;
      if (a == 2)
      {
          a = 4;
      }

      printf("%d", a);

      return 0;
  }




On Wed, Sep 28, 2011 at 7:54 PM, Jim Goodnow II <Jim at thegoodnows.net> wrote:

> Hi Arjun,
>
> Do you have a short example of the code that you are analyzing. It is
> possible that the static analyzer has determined that the if statement
> is in a path that never gets executed. It should still be in the AST
> though. You can use -ast-dump to look at the AST directly.
>
>  - jim
>
> On 9/28/2011 7:40 PM, John McCall wrote:
> > On Sep 28, 2011, at 7:34 PM, funceval wrote:
> >> Not even constant folding and constant propagation?
> > Correct.  A few places in the AST, like array dimensions, do compute and
> store the value of a constant expression, but only in unevaluated contexts,
> and the original source information is never thrown away.
> >
> > John.
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >
> >
> _______________________________________________
> 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/20110928/20762b26/attachment.html>


More information about the cfe-dev mailing list