From: Ted Kremenek Date: Mon, 10 Dec 2007 22:01:22 +0000 (+0000) Subject: Fixed off-by-one-error when resizing Bitvectors used for X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76315cabb3d65145dd1f49696c725c04df378cd5;p=clang Fixed off-by-one-error when resizing Bitvectors used for dataflow analysis over expressions and decls. This should fix bug 1847: http://llvm.org/bugs/show_bug.cgi?id=1847 Thanks to Török Edwin for providing a test case that identified the problem. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44813 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/ExprDeclBitVector.h b/include/clang/Analysis/ExprDeclBitVector.h index 4cd9faa260..2ddd985f4c 100644 --- a/include/clang/Analysis/ExprDeclBitVector.h +++ b/include/clang/Analysis/ExprDeclBitVector.h @@ -73,7 +73,7 @@ struct DeclBitVector_Types { public: void resetValues(AnalysisDataTy& AD) { - DeclBV.resize(AD.getNumDecls()); + DeclBV.resize(AD.getNumDecls()+1); DeclBV.reset(); } @@ -172,7 +172,7 @@ struct ExprDeclBitVector_Types { void resetValues(AnalysisDataTy& AD) { ParentRef(*this).resetValues(AD); - ExprBV.resize(AD.getNumExprs()); + ExprBV.resize(AD.getNumExprs()+1); ExprBV.reset(); }