Author: sberg Date: Fri Jun 24 11:26:43 2016 New Revision: 273689 URL: http://llvm.org/viewvc/llvm-project?rev=273689&view=rev Log: DeadStoresChecker: Don't warn about dead stores into volatile variables
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp cfe/trunk/test/Analysis/dead-stores.c Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp?rev=273689&r1=273688&r2=273689&view=diff ============================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp Fri Jun 24 11:26:43 2016 @@ -278,6 +278,8 @@ public: RHS = RHS->IgnoreParenCasts(); QualType T = VD->getType(); + if (T.isVolatileQualified()) + return; if (T->isPointerType() || T->isObjCObjectPointerType()) { if (RHS->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNull)) return; Modified: cfe/trunk/test/Analysis/dead-stores.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dead-stores.c?rev=273689&r1=273688&r2=273689&view=diff ============================================================================== --- cfe/trunk/test/Analysis/dead-stores.c (original) +++ cfe/trunk/test/Analysis/dead-stores.c Fri Jun 24 11:26:43 2016 @@ -569,3 +569,7 @@ void testBOComma() { } +void testVolatile() { + volatile int v; + v = 0; // no warning +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits