summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-03-26 13:44:29 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-03-26 13:44:29 +0000
commit2e7d6cd0ec898ac5ff205a2aed096e20ab315cad (patch)
tree9446479027dfbcfc4b77cb9bf8f0e146fa95f4cc
parent56a784d2f672411060364766ea9f7899066d8e35 (diff)
downloadbcm5719-llvm-2e7d6cd0ec898ac5ff205a2aed096e20ab315cad.tar.gz
bcm5719-llvm-2e7d6cd0ec898ac5ff205a2aed096e20ab315cad.zip
Fix uninitialized read of CalleeWithThisReturn.
CalleeWithThisReturn can be left initialized if HasThisReturn() is false. This change reverses the order of checks in EmitFunctionEpilog such that CalleeWithThisReturn is only examined when it has a meaningful value. Found with MemorySanitizer. llvm-svn: 178015
-rw-r--r--clang/lib/CodeGen/CGCall.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index faf32e30083..1fb88b009f4 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1722,7 +1722,7 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI) {
// the same object as CXXThisValue, use the return value from the CallInst.
// We will not need to keep 'this' alive through the callsite. It also enables
// optimizations in the backend, such as tail call optimization.
- if (CalleeWithThisReturn && CGM.getCXXABI().HasThisReturn(CurGD)) {
+ if (CGM.getCXXABI().HasThisReturn(CurGD) && CalleeWithThisReturn) {
llvm::BasicBlock *IP = Builder.GetInsertBlock();
llvm::CallInst *Callsite;
if (!IP->empty() && (Callsite = dyn_cast<llvm::CallInst>(&IP->back())) &&
OpenPOWER on IntegriCloud