<br><br><div class="gmail_quote">On Fri, Jun 11, 2010 at 11:55 PM, Cristian Zamfir <span dir="ltr"><<a href="mailto:cristian.zamfir@epfl.ch">cristian.zamfir@epfl.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Hello,<br>
<br>
I am new to the Clang Static Analyzer and I am trying to determine if it can be used to find the set of paths from the beginning of a program to a given basic bloc in the program. Enumerating all these paths will most likely be intractable, but obtaining them on-demand may be possible. This is in a way similar to a backward slicing algorithm.<br>

<br>
Here is a simple example. Could the analyzer figure out that the only path through function func that triggers the bug must execute the first case of the switch statement?<br>
<br>
int func(int x) {<br>
        int y;<br>
        switch(x) {<br>
                case 1:<br>
                        y = 0;<br>
                        break;<br>
                case 2:<br>
                        y = 1;<br>
                        break;<br>
                default:<br>
                        y = 2;<br>
                        break;<br>
        }<br>
<br>
        if (y != 0)<br>
                return 0;<br>
        else<br>
                return 1;<br>
}<br>
<br>
int main (int argc, char* argv) {<br>
        ...<br>
        if( func(argc) == 1 )<br>
                BUG();                        //this is the target basic block<br>
        ...<br>
}<br>
<br>
Is this already possible? If not, how complex would it be to write in the analyzer? Does the analyzer support path-sensitive analyses?<br></blockquote><div><br>There are two analysis engine implemented. The standard flow sensitive data flow analysis supports both forward and backward analysis. The path sensitive analysis engine only supports forward analysis.<br>
 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
I also have a few other questions:<br>
<br>
Does the analyzer support deadlock and data-race detection? I did not see this in the source code.<br></blockquote><div><br>No.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<br>
Also, I thought that normally static analysis will have lots of false positives. I ran scan-build on the linux kernel and it reported no bugs. Instead, it reported a few bugs in the analyzer.<br>
<br>
Thanks a lot,<br>
Cristi<br>
<br>
<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>
</blockquote></div><br>