<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - False positive: Variable dependency not taken into account while analysing"
   href="http://llvm.org/bugs/show_bug.cgi?id=17954">17954</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>False positive: Variable dependency not taken into account while analysing
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>prasannatsmkumar@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11552" name="attach_11552" title="clang analyser report showing a false positive">attachment 11552</a> <a href="attachment.cgi?id=11552&action=edit" title="clang analyser report showing a false positive">[details]</a></span>
clang analyser report showing a false positive

I ran clang static analyser against Octave (octave.org) project. It reported a
lot of false positives.

Please see the report for the code and issue reported by clang analyser. It is
a false positive. Clang static analyser does not take care of dependency
between variables.

In this case variable 'pi' is null when 'val.pi' is null, non null when
'val.pi' is not null. When analysing the below snippet clang analyser reports
that "Null pointer passed as an argument to a 'nonnull' parameter"

---- code snippet ----

fn(const class1 &val)
    : pi(val.pi ? malloc(sieof(int)) : 0)
{
    if (pi) {
        memcpy(pi, val.pi, nbytes);
}

---- code snippet ----

The report shows a similar code. Please have a look at it.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>