summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/UninitializedValues.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-07-16 22:27:02 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-07-16 22:27:02 +0000
commit7cf5a37605a2be562ded18716759632ab405c3ca (patch)
tree171eadf79dac605ff1f19f7fe0e66e9456d09905 /clang/lib/Analysis/UninitializedValues.cpp
parenta7606b993cd782c901c59ddb5015e52d8b094ce4 (diff)
downloadbcm5719-llvm-7cf5a37605a2be562ded18716759632ab405c3ca.tar.gz
bcm5719-llvm-7cf5a37605a2be562ded18716759632ab405c3ca.zip
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. llvm-svn: 135359
Diffstat (limited to 'clang/lib/Analysis/UninitializedValues.cpp')
-rw-r--r--clang/lib/Analysis/UninitializedValues.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp
index 5e00eebec87..1d6959d81b1 100644
--- a/clang/lib/Analysis/UninitializedValues.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud