<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - static analyzer false positive: non-null value is believed to be null [clang-analyzer-core.uninitialized.UndefReturn]"
   href="https://bugs.llvm.org/show_bug.cgi?id=42815">42815</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>static analyzer false positive: non-null value is believed to be null [clang-analyzer-core.uninitialized.UndefReturn]
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>enhancement
          </td>
        </tr>

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

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

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

        <tr>
          <th>Reporter</th>
          <td>raffael@casagrande.ch
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dcoughlin@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Overview:
Under some circumstances, the static analyer believes that a null reference is
being returned when it is clearly not. 

Steps to Reproduce
1) run scan-build g++ main.cc


Actual Results:

In file included from main.cc:1:
In file included from ./Eigen/Eigen:2:
In file included from ./Eigen/Sparse:26:
In file included from ./Eigen/SparseCore:39:
./Eigen/src/SparseCore/CompressedStorage.h:121:80: warning: Returning null
reference
    inline StorageIndex& index(Index i) { eigen_internal_assert(m_indices!=0);
return m_indices[i]; }
                                                                              
^~~~~~~~~~~~~~~~~~~
1 warning generated.
scan-build: 1 bug found.


Expected Results:
No bug should be found.


Build information:
The bug appears on the latest trunk build (git hash
89fb9e8ce151d48b56a6bc25de62e93743e0d6c1), pulled on July 29th 2019. The bug
was first encountered on clang-tidy-8.


Additional Information:

- The attached example code illustrates the issue. I've reduced it as much as
possible, but I couldn't get rid of the Eigen dependency in reasonable time,
therefore I've just included it.
- By uncommenting line 18 in main.cc the warning disappears, but this is of
course not practical.</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>