fixed inout analysis for function's parameters

This commit is contained in:
ALEXks
2025-07-09 12:00:27 +03:00
parent 177433a95b
commit 68bd21b7b0
2 changed files with 21 additions and 2 deletions

View File

@@ -779,6 +779,20 @@ static void checkSpecList(SgExpression *spec, FuncInfo* currF, const map<string,
}
}
static void checkInTypeDescription(SgExpression *ex, FuncInfo* currF, const map<string, int>& parNames)
{
if (ex)
{
if (ex->variant() == ARRAY_REF)
fillIn(currF, ex->lhs(), parNames, false);
else
{
checkInTypeDescription(ex->lhs(), currF, parNames);
checkInTypeDescription(ex->rhs(), currF, parNames);
}
}
}
static void fillInOut(FuncInfo *currF, SgStatement *start, SgStatement *last, const set<SgStatement*>& activeOps)
{
if (currF->funcParams.countOfPars == 0)
@@ -798,8 +812,13 @@ static void fillInOut(FuncInfo *currF, SgStatement *start, SgStatement *last, co
if (st->variant() == ENTRY_STAT)
continue;
if (isSgExecutableStatement(st) == NULL) {
checkInTypeDescription(st->expr(0), currF, parNames);
continue;
}
if (isSgExecutableStatement(st) == NULL || st->lineNumber() <= 0)
if (st->lineNumber() <= 0)
continue;
if (activeOps.size() && activeOps.find(st) == activeOps.end())