sberg created this revision. sberg added a reviewer: zaks.anna. sberg added a subscriber: cfe-commits.
http://reviews.llvm.org/D21682 Files: lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp test/Analysis/dead-stores.c Index: test/Analysis/dead-stores.c =================================================================== --- test/Analysis/dead-stores.c +++ test/Analysis/dead-stores.c @@ -569,3 +569,7 @@ } +void testVolatile() { + volatile int v; + v = 0; // no warning +} Index: lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -278,6 +278,8 @@ RHS = RHS->IgnoreParenCasts(); QualType T = VD->getType(); + if (T.isVolatileQualified()) + return; if (T->isPointerType() || T->isObjCObjectPointerType()) { if (RHS->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNull)) return;
Index: test/Analysis/dead-stores.c =================================================================== --- test/Analysis/dead-stores.c +++ test/Analysis/dead-stores.c @@ -569,3 +569,7 @@ } +void testVolatile() { + volatile int v; + v = 0; // no warning +} Index: lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -278,6 +278,8 @@ RHS = RHS->IgnoreParenCasts(); QualType T = VD->getType(); + if (T.isVolatileQualified()) + return; if (T->isPointerType() || T->isObjCObjectPointerType()) { if (RHS->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNull)) return;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits