summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-01-17 14:20:14 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-01-17 14:20:14 +0000
commit6f4d3a2e39fa41b278b22468a91474fd1f9d0955 (patch)
tree1507a78dd56cac0485f7605c0209dfc0a161b7f4
parentf557987b155cc9bf88ad1e497cf796b3c193d12e (diff)
downloadbcm5719-llvm-6f4d3a2e39fa41b278b22468a91474fd1f9d0955.tar.gz
bcm5719-llvm-6f4d3a2e39fa41b278b22468a91474fd1f9d0955.zip
[msan] Fix a uninitialized-use bug in the template argument diffing
logic. In one place we would try to check for the difference between integers even if we were missing one of the integers. This would eventually end up reading uninitialized data out of the APSInt objects. The fix is to short circuit the sameness test when we don't have integers on both sides. This fixes a test failure I was seeing with MSan. Not sure whether other bots were seeing it or not, but yay MSan. In particular the feature to very carefully track origins back through stores throughout the program was invaluable. llvm-svn: 226375
-rw-r--r--clang/lib/AST/ASTDiagnostic.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 3212359db18..a8ab9a2d77b 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -1034,7 +1034,8 @@ class TemplateDiff {
if (!HasToInt && ToExpr)
HasToInt = GetInt(Context, ToIter, ToExpr, ToInt);
Tree.SetNode(FromInt, ToInt, HasFromInt, HasToInt);
- Tree.SetSame(IsSameConvertedInt(ParamWidth, FromInt, ToInt));
+ Tree.SetSame(HasFromInt && HasToInt &&
+ IsSameConvertedInt(ParamWidth, FromInt, ToInt));
Tree.SetDefault(FromIter.isEnd() && HasFromInt,
ToIter.isEnd() && HasToInt);
Tree.SetKind(DiffTree::Integer);
OpenPOWER on IntegriCloud