diff --git a/sapfor/experts/Sapfor_2017/_src/Transformations/private_removing.cpp b/sapfor/experts/Sapfor_2017/_src/Transformations/private_removing.cpp index 49638da..b2215fe 100644 --- a/sapfor/experts/Sapfor_2017/_src/Transformations/private_removing.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Transformations/private_removing.cpp @@ -433,9 +433,8 @@ static void fillReadShortFixedSumscripts(SgExpression* exp, const PrivateToRemov { auto subscripts = getShortFixedSubscriptsVector((SgArrayRefExp*)exp, var.fixedDimensions); fixedSubscripts.insert(subscripts); + return; } - - return; } fillReadShortFixedSumscripts(exp->lhs(), var, fixedSubscripts); @@ -1350,16 +1349,14 @@ static SgForStmt* getScopeLoopStmt(SgStatement* stmt) static int getDimension(SgSymbol* arraySym) { - SgStatement* declarationStmt = arraySym->declaredInStmt(); - if (declarationStmt == nullptr) - return 0; - - SgExprListExp* expList = (SgExprListExp*)declarationStmt->expr(0); - for (int i = 0; i < expList->length(); ++i) - if (expList->elem(i)->symbol()->identifier() == arraySym->identifier()) - return ((SgExprListExp*)expList->elem(i)->lhs())->length(); + SgExpression* declExpr = arraySym->makeDeclExpr(); + if (declExpr == nullptr) + printInternalError(convertFileName(__FILE__).c_str(), __LINE__); - return 0; + int dimensionNum = ((SgExprListExp*)declExpr->lhs())->length(); + delete declExpr; + + return dimensionNum; } // findChildLoop returns LoopGraph for provided loop statement