<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 RunPathSensitiveChecks overwrites files with subsequent calls"
   href="https://bugs.llvm.org/show_bug.cgi?id=42601">42601</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Static Analyzer RunPathSensitiveChecks overwrites files with subsequent calls
          </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>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>dcoughlin@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>erich.keane@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dcoughlin@apple.com, ekarpenkov@apple.com, ganna@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I got here in a little different of a way, but I was able to reproduce this
pretty trivially. 

To reproduce, run
test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp (only the
clang-cc1 invocation is necessary to see the problem, so this isn't a
exploded-graph-rewriter bug), except add a move or copy constructor to struct
"S".

The .dot file ends up containing way less data, because AnalysisConsumer's
HandleDeclsCallGraph ends up calling HandleCode 2x, which then calls
RunPathSensitiveChecks.  THAT calls DumpGraph 2x, which creates a new stream
and overwrites the previous one.

While the move/copy ctor are required to get this to reproduce (thanks to logic
in shouldSkipFunction), I believe the root problem (multiple calls to DumpGraph
destroy/rewrite the file) is the true bug here.

My Diff:
diff --git
a/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
b/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
index b3d4aef..f7aa892 100644
---
a/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
+++
b/clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
@@ -10,6 +10,7 @@

 struct S {
   S() {}
+  S(S&&){}
 };

 void test() {


My invocation: ./bin/clang -cc1 -analyze -triple x86_64-unknown-linux-gnu
-analyzer-checker=core -analyzer-dump-egraph=test.dot
../clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
-mllvm -stats</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>