diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-03-26 13:44:29 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-03-26 13:44:29 +0000 |
commit | 76ed61788e88ab1f6345fd3611e1a618f1c334e3 (patch) | |
tree | 12372043879945c834f465973670b6b4c9183a0c /lib/CodeGen/CGCall.cpp | |
parent | 231b2bc2a0ca854174ac0095b3e2fad6a50d5844 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178015 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index faf32e3008..1fb88b009f 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/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())) && |