diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-07-16 22:27:02 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-07-16 22:27:02 +0000 |
commit | 8435069798b5621615f9f65c471c7e7808316b20 (patch) | |
tree | 7ce0e2eb5f8f73ed043956cd0cb30cb1f92ca588 /lib | |
parent | a6c2b3a648913d47703625acb17671dd2d926bbc (diff) |
Revert r135217, which wasn't the correct fix for PR10358. With this
patch, we actually move the state-machine for the value set backwards
one step. This can pretty easily lead to infinite loops where we
continually try to propagate a bit, succeed for one iteration, but then
back up because we find an uninitialized use.
A reduced test case from PR10379 is included.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135359 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/UninitializedValues.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp index 5e00eebec8..1d6959d81b 100644 --- a/lib/Analysis/UninitializedValues.cpp +++ b/lib/Analysis/UninitializedValues.cpp @@ -495,11 +495,9 @@ void TransferFunctions::VisitBinaryOperator(clang::BinaryOperator *bo) { ValueVector::reference val = vals[vd]; if (isUninitialized(val)) { - if (bo->getOpcode() != BO_Assign) { + if (bo->getOpcode() != BO_Assign) reportUninit(res.getDeclRefExpr(), vd, isAlwaysUninit(val)); - val = Unknown; - } else - val = Initialized; + val = Initialized; } return; } @@ -528,7 +526,7 @@ void TransferFunctions::VisitUnaryOperator(clang::UnaryOperator *uo) { if (isUninitialized(val)) { reportUninit(res.getDeclRefExpr(), vd, isAlwaysUninit(val)); // Don't cascade warnings. - val = Unknown; + val = Initialized; } return; } @@ -560,7 +558,7 @@ void TransferFunctions::VisitCastExpr(clang::CastExpr *ce) { if (isUninitialized(val)) { reportUninit(res.getDeclRefExpr(), vd, isAlwaysUninit(val)); // Don't cascade warnings. - vals[vd] = Unknown; + vals[vd] = Initialized; } } return; |