Проход удаления приватных переменных: исправление бага из bugreport_1703086913 #28
@@ -1474,7 +1474,8 @@ static vector<DefUseStmtsPair> buildDefUsePairs(Context* ctx, const CFG_Type& CF
|
||||
|
||||
set<int> RD_defArgs = RD_forUseArg->second; // make copy
|
||||
|
||||
// delete recursive definition from RD def args:
|
||||
// delete recursive and uninit definition from RD def args:
|
||||
set<int> tmpRD_defArgs;
|
||||
for (int defArgNum : RD_defArgs)
|
||||
{
|
||||
if (defArgNum == SAPFOR::CFG_VAL::UNINIT)
|
||||
@@ -1487,11 +1488,11 @@ static vector<DefUseStmtsPair> buildDefUsePairs(Context* ctx, const CFG_Type& CF
|
||||
SgStatement* defStmt = defInsAndBlock.first->getOperator();
|
||||
auto defInsertedStmt = findInsertedStmt(insertedStmts, defStmt);
|
||||
if (useInsertedStmt.relatedToStmt == defInsertedStmt->relatedToStmt)
|
||||
{
|
||||
RD_defArgs.erase(defArgNum);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
|
||||
tmpRD_defArgs.insert(defArgNum);
|
||||
}
|
||||
RD_defArgs.swap(tmpRD_defArgs);
|
||||
|
||||
if (RD_defArgs.size() == 0) // argument is not initialized
|
||||
{
|
||||
@@ -1551,6 +1552,9 @@ static vector<DefUseStmtsPair> buildDefUsePairs(Context* ctx, const CFG_Type& CF
|
||||
else
|
||||
{
|
||||
auto defInsAndBlock = getInstructionAndBlockByNumber(CFGraph, *RD_defArgs.begin());
|
||||
if (defInsAndBlock.first == nullptr)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
defStmt = defInsAndBlock.first->getOperator();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user