<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Arjun,<div><br></div><div>The reason why the callback is not called is that IfStmt is not a CFGElement - it's a CFGTerminator (it expresses only control flow). See the CFG block dump below. We only call checkPostStmt/checkPreStmt for statements that correspond to CFG elements. </div><div><br></div><div>If you want to visit the conditions within the if statements (or other branches), use <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">checkBranchCondition() </span>instead. </div><div><br></div><div>Cheers,</div><div>Anna.</div><div><br></div><div><div>[ B3 ]</div><div>      1: foo</div><div>      2: [B3.1]</div><div>      3: [B3.2]()</div><div>      4: int a = foo();</div><div>      5: foo</div><div>      6: [B3.5]</div><div>      7: [B3.6]()</div><div>      8: int b = foo();</div><div>      9: a</div><div>     10: &[B3.9]</div><div>     11: "%d"</div><div>     12: [B3.11]</div><div>     13: [B3.12]</div><div>     14: scanf</div><div>     15: [B3.14]</div><div>     16: [B3.15]([B3.13], [B3.10])</div><div>     17: a</div><div>     18: [B3.17]</div><div>     19: b</div><div>     20: [B3.19]</div><div>     21: [B3.18] + [B3.20]</div><div>     22: a</div><div>     23: [B3.22] = [B3.21]</div><div>     24: a</div><div>     25: [B3.24]</div><div>     26: 2</div><div>     27: [B3.25] == [B3.26]</div><div>      T: if [B3.27]</div><div>    Predecessors (1): B4</div><div>    Successors (2): B2 B1</div><div><br></div></div><div><div><div>On Sep 28, 2011, at 9:03 PM, Arjun Singri wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>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.</div><div><br></div>

Here is the code I am trying to analyze:<div><br></div><div><div>#include<stdio.h></div><div><br></div><div>  int foo() { return 2; }</div><div><br></div><div>  int main(void)</div><div>  {</div><div>      int a = foo();</div>

<div>      int b = foo();</div><div><br></div><div>      scanf("%d", &a);</div><div><br></div><div>      a = a + b;</div><div>      if (a == 2)</div><div>      {</div><div>          a = 4;</div><div>      }</div>

<div><br></div><div>      printf("%d", a);</div><div><br></div><div>      return 0;</div><div>  }</div><div><br></div><div><br></div><div><br></div><br><div class="gmail_quote">On Wed, Sep 28, 2011 at 7:54 PM, Jim Goodnow II <span dir="ltr"><<a href="mailto:Jim@thegoodnows.net">Jim@thegoodnows.net</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Arjun,<br>
<br>
Do you have a short example of the code that you are analyzing. It is<br>
possible that the static analyzer has determined that the if statement<br>
is in a path that never gets executed. It should still be in the AST<br>
though. You can use -ast-dump to look at the AST directly.<br>
<font color="#888888"><br>
  - jim<br>
</font><div><div></div><div class="h5"><br>
On 9/28/2011 7:40 PM, John McCall wrote:<br>
> On Sep 28, 2011, at 7:34 PM, funceval wrote:<br>
>> Not even constant folding and constant propagation?<br>
> 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.<br>
><br>
> John.<br>
</div></div><div><div></div><div class="h5">> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
><br>
><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>
</blockquote></div><br></div></body></html>