r178015 - Fix uninitialized read of CalleeWithThisReturn.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Tue Mar 26 06:44:29 PDT 2013
Author: eugenis
Date: Tue Mar 26 08:44:29 2013
New Revision: 178015
URL: http://llvm.org/viewvc/llvm-project?rev=178015&view=rev
Log:
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.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=178015&r1=178014&r2=178015&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Mar 26 08:44:29 2013
@@ -1722,7 +1722,7 @@ void CodeGenFunction::EmitFunctionEpilog
// 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())) &&
More information about the cfe-commits
mailing list