[llvm-bugs] [Bug 42601] New: Static Analyzer RunPathSensitiveChecks overwrites files with subsequent calls

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 12 07:52:43 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42601

            Bug ID: 42601
           Summary: Static Analyzer RunPathSensitiveChecks overwrites
                    files with subsequent calls
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: erich.keane at intel.com
                CC: dcoughlin at apple.com, ekarpenkov at apple.com,
                    ganna at apple.com, llvm-bugs at lists.llvm.org

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190712/d3951aef/attachment.html>


More information about the llvm-bugs mailing list