clang hangs with -warn-uninit-values
| Bugzilla Link | 1847 |
| Resolution | FIXED |
| Resolved on | Nov 07, 2018 00:22 |
| Version | unspecified |
| OS | Linux |
| CC | @tkremenek |
Extended Description
$ clang -warn-uninit-values str3.i
... doesn't finish even after minutes ...
$ cat str3.i char *cli_strrcpy(char *dest, const char *source) { if(!dest || !source) { return ((void *)0); } while((*dest++ = *source++)); return --dest; }
Really fixed in patch 44822 (last fix was a bandage that wasn't the right fix):
http://llvm.org/viewvc/llvm-project?rev=44822&view=rev
Fixed with patch 44813:
http://llvm.org/viewvc/llvm-project?rev=44813&view=rev
Fixed with patch 44813:
http://llvm.org/viewvc/llvm-project?rev=44813&view=rev
I can recreate this bug on Linux (does not appear on Mac OS X). I'm investigating.
I'll try reproducing the problem tomorrow on a 32-bit x86 linux box (I don't immediately have access to an x86-64 box on Linux). Some useful information might be to run clang with your test case within gdb and ctrl-c the infinite loop and get a stack trace. It will give me a better idea of what is broken.
Here are a few backtraces (~30 secs apart). Let me know if you want me to dump some variables.
(gdb) r -warn-uninit-value str3.i Program received signal SIGINT, Interrupt. [Switching to Thread 0x2b8d33dc1e90 (LWP 26063)] 0x0000000000655b8b in clang::DataflowWorkListTy::isEmpty (this=0x7fff76d0c558) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/FlowSensitive/DataflowSolver.h:46 46 bool isEmpty() const { return wlist.empty(); } (gdb) bt #0 0x0000000000655b8b in clang::DataflowWorkListTy::isEmpty (this=0x7fff76d0c558) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/FlowSensitive/DataflowSolver.h:46 #1 0x000000000065a818 in SolveDataflowEquations (this=0x7fff76d0c550, cfg=@0xb68900) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/FlowSensitive/DataflowSolver.h:186 #2 0x000000000065d33d in runOnCFG (this=0x7fff76d0c550, cfg=@0xb68900) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/FlowSensitive/DataflowSolver.h:148 #3 0x000000000065d3af in clang::CheckUninitializedValues (cfg=@0xb68900, Ctx=@0x7fff76d0c880, Diags=@0x7fff76d0d040, FullUninitTaint=false) at UninitializedValues.cpp:238 #4 0x00000000005f71a8 in VisitCFG (this=0xb57940, C=@0xb68900) at ASTConsumers.cpp:536 #5 0x00000000005f836d in HandleTopLevelDecl (this=0xb57940, D=0xb689b0) at ASTConsumers.cpp:451 #6 0x0000000000662d14 in clang::ParseAST (PP=@0x7fff76d0cd40, MainFileID=1, Consumer=0xb57940, PrintStats=false) at ASTStreamer.cpp:92 #7 0x000000000061c34b in ProcessInputFile (PP=@0x7fff76d0cd40, MainFileID=1, InFile=@0xb53bf0, SourceMgr=@0x7fff76d0d0d0, OurDiagnosticClient=@0xb53650, HeaderInfo=@0x7fff76d0cfb0, LangInfo=@0x7fff76d0d1b0) at clang.cpp:940 #8 0x000000000061df43 in main (argc=3, argv=0x7fff76d0d318) at clang.cpp:1052
Program received signal SIGINT, Interrupt.
0x000000000065dc74 in llvm::DenseMap<clang::ProgramEdge, clang::ExprDeclBitVector_Types::ValTy, llvm::DenseMapInfoclang::ProgramEdge, llvm::DenseMapInfoclang::ExprDeclBitVector_Types::ValTy >::LookupBucketFor (this=0x7fff76d0c770, Val=@0x7fff76d0c3e8, FoundBucket=@0x7fff76d0c388) at /home/edwin/llvm-svn/llvm/include/llvm/ADT/DenseMap.h:284
284 BucketT *ThisBucket = BucketsPtr + (BucketNo & (NumBuckets-1));
(gdb) bt
#0 0x000000000065dc74 in llvm::DenseMap<clang::ProgramEdge, clang::ExprDeclBitVector_Types::ValTy, llvm::DenseMapInfoclang::ProgramEdge, llvm::DenseMapInfoclang::ExprDeclBitVector_Types::ValTy >::LookupBucketFor (this=0x7fff76d0c770, Val=@0x7fff76d0c3e8, FoundBucket=@0x7fff76d0c388) at /home/edwin/llvm-svn/llvm/include/llvm/ADT/DenseMap.h:284
#1 0x000000000065dd65 in llvm::DenseMap<clang::ProgramEdge, clang::ExprDeclBitVector_Types::ValTy, llvm::DenseMapInfoclang::ProgramEdge, llvm::DenseMapInfoclang::ExprDeclBitVector_Types::ValTy >::find (this=0x7fff76d0c770, Val=@0x7fff76d0c3e8) at /home/edwin/llvm-svn/llvm/include/llvm/ADT/DenseMap.h:139
#2 0x0000000000659385 in UpdateEdgeValue (this=0x7fff76d0c550, E={clang::ProgramEdge = {Src = 11967075, Dst = 11967072},
Program received signal SIGINT, Interrupt. 0x000000000065b574 in VisitBinaryOperator (this=0x7fff76d0c678, B=0xb69290) at UninitializedValues.cpp:119 119 return VisitStmt(B); (gdb) bt #0 0x000000000065b574 in VisitBinaryOperator (this=0x7fff76d0c678, B=0xb69290) at UninitializedValues.cpp:119 #1 0x000000000065b80f in VisitBinAssign (this=0x7fff76d0c678, S=0xb69290) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/AST/StmtVisitor.h:132 #2 0x0000000000659ad5 in Visit (this=0x7fff76d0c678, S=0xb69290) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/AST/StmtVisitor.h:57 #3 0x000000000065a38e in Visit (this=0x7fff76d0c678, S=0xb69290) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/Visitors/CFGStmtVisitor.h:51 #4 0x000000000065a5a7 in Visit (this=0x7fff76d0c678, S=0xb69290) at UninitializedValues.cpp:171 #5 0x000000000065aa0c in VisitStmt (this=0x7fff76d0c678, S=0xb692d0) at UninitializedValues.cpp:164 #6 0x000000000065ad33 in VisitExpr (this=0x7fff76d0c678, S=0xb692d0) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/AST/StmtNodes.def:57 #7 0x000000000065ae21 in VisitParenExpr (this=0x7fff76d0c678, S=0xb692d0) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/AST/StmtNodes.def:65 #8 0x000000000065a0cd in Visit (this=0x7fff76d0c678, S=0xb692d0) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/AST/StmtNodes.def:65 #9 0x000000000065a38e in Visit (this=0x7fff76d0c678, S=0xb692d0) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/Visitors/CFGStmtVisitor.h:51 #10 0x000000000065a5a7 in Visit (this=0x7fff76d0c678, S=0xb692d0) at UninitializedValues.cpp:171 #11 0x000000000065aa0c in VisitStmt (this=0x7fff76d0c678, S=0xb69300) at UninitializedValues.cpp:164 #12 0x000000000065ad33 in VisitExpr (this=0x7fff76d0c678, S=0xb69300) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/AST/StmtNodes.def:57 #13 0x000000000065ae21 in VisitParenExpr (this=0x7fff76d0c678, S=0xb69300) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/AST/StmtNodes.def:65 #14 0x000000000065a0cd in Visit (this=0x7fff76d0c678, S=0xb69300) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/AST/StmtNodes.def:65 #15 0x000000000065a38e in Visit (this=0x7fff76d0c678, S=0xb69300) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/Visitors/CFGStmtVisitor.h:51 #16 0x000000000065a3f4 in BlockStmt_VisitExpr (this=0x7fff76d0c678, E=0xb69300) at UninitializedValues.cpp:177 #17 0x000000000065a709 in BlockStmt_Visit (this=0x7fff76d0c678, S=0xb69300) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/Visitors/CFGStmtVisitor.h:82 #18 0x000000000065a77e in ProcessBlock (this=0x7fff76d0c550, B=0xb69a60) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/FlowSensitive/DataflowSolver.h:232 #19 0x000000000065a7eb in SolveDataflowEquations (this=0x7fff76d0c550, cfg=@0xb68900) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/FlowSensitive/DataflowSolver.h:189 #20 0x000000000065d33d in runOnCFG (this=0x7fff76d0c550, cfg=@0xb68900) at /home/edwin/llvm-svn/llvm/tools/clang/Analysis/../include/clang/Analysis/FlowSensitive/DataflowSolver.h:148 #21 0x000000000065d3af in clang::CheckUninitializedValues (cfg=@0xb68900, Ctx=@0x7fff76d0c880, Diags=@0x7fff76d0d040, FullUninitTaint=false) at UninitializedValues.cpp:238 #22 0x00000000005f71a8 in VisitCFG (this=0xb57940, C=@0xb68900) at ASTConsumers.cpp:536 #23 0x00000000005f836d in HandleTopLevelDecl (this=0xb57940, D=0xb689b0) at ASTConsumers.cpp:451 #24 0x0000000000662d14 in clang::ParseAST (PP=@0x7fff76d0cd40, MainFileID=1, Consumer=0xb57940, PrintStats=false) at ASTStreamer.cpp:92 #25 0x000000000061c34b in ProcessInputFile (PP=@0x7fff76d0cd40, MainFileID=1, InFile=@0xb53bf0, SourceMgr=@0x7fff76d0d0d0, OurDiagnosticClient=@0xb53650, HeaderInfo=@0x7fff76d0cfb0, LangInfo=@0x7fff76d0d1b0) at clang.cpp:940 #26 0x000000000061df43 in main (argc=3, argv=0x7fff76d0d318) at clang.cpp:1052
(gdb) bt
#0 0x00000000006a09a5 in llvm::DenseMap<clang::Expr const*, unsigned int, llvm::DenseMapInfo<clang::Expr const*>, llvm::DenseMapInfo
I'll try reproducing the problem tomorrow on a 32-bit x86 linux box (I don't immediately have access to an x86-64 box on Linux). Some useful information might be to run clang with your test case within gdb and ctrl-c the infinite loop and get a stack trace. It will give me a better idea of what is broken.
I cannot reproduce this bug. Török: What revision of clang are you using (svn info)? Mine is 44739.
I was using svn r44737. I updated to 44740, but I only got this change: U www/index.html Updated to revision 44740.
So I assume we are using same clang.
My LLVM's svn revision is r44737 too.
I am using a x86-64 box on Linux: Linux lightspeed2 2.6.23-rc8-hrt1-cfs-v22-g1bef7dc0-dirty #17 Sun Sep 30 18:49:34 EEST 2007 x86_64 GNU/Linux
Is there any other info I can send you to help reproduce the problem?
I cannot reproduce this bug. Török: What revision of clang are you using (svn info)? Mine is 44739.