fixed fdvm, fixed errors with interfacesg

This commit is contained in:
ALEXks
2024-11-17 17:19:58 +03:00
parent dacca844ed
commit 2e2bcadfa1
3 changed files with 25 additions and 3 deletions

View File

@@ -1237,6 +1237,18 @@ int is_deleted_module_symbol(SgSymbol *s) // deleted because it was renamed (par
return 0; return 0;
} }
int hasSameOriginalName(SgSymbol *s)
{
SgSymbol *symb = cur_func->symbol()->next();
while (symb != s)
{
if (ORIGINAL_SYMBOL(symb) == ORIGINAL_SYMBOL(s))
return 1;
symb = symb->next();
}
return 0;
}
void EnterDataRegionForVariablesInMainProgram(SgStatement *st) void EnterDataRegionForVariablesInMainProgram(SgStatement *st)
{ {
symb_list *sl; symb_list *sl;
@@ -1250,7 +1262,7 @@ void EnterDataRegionForVariablesInMainProgram(SgStatement *st)
s = cur_func->symbol()->next(); s = cur_func->symbol()->next();
while (IS_BY_USE(s)) while (IS_BY_USE(s))
{ {
if (!is_deleted_module_symbol(s) && IS_ARRAY(s) && s->variant() == VARIABLE_NAME && !IS_ALLOCATABLE(s) && !IS_POINTER_F90(s) && !HEADER(s) ) if (!is_deleted_module_symbol(s) && IS_ARRAY(s) && !hasSameOriginalName(s) && s->variant() == VARIABLE_NAME && !IS_ALLOCATABLE(s) && !IS_POINTER_F90(s) && !HEADER(s) )
st->insertStmtAfter(*DataEnter(new SgVarRefExp(s),ConstRef(0)),*st->controlParent()); st->insertStmtAfter(*DataEnter(new SgVarRefExp(s),ConstRef(0)),*st->controlParent());
s = s->next(); s = s->next();
} }
@@ -1270,7 +1282,7 @@ void ExitDataRegionForVariablesInMainProgram(SgStatement *st)
s=cur_func->symbol()->next(); s=cur_func->symbol()->next();
while (IS_BY_USE(s)) while (IS_BY_USE(s))
{ {
if (!is_deleted_module_symbol(s) && IS_ARRAY(s) && s->variant() == VARIABLE_NAME && !IS_ALLOCATABLE(s) && !IS_POINTER_F90(s) && !HEADER(s) ) if (!is_deleted_module_symbol(s) && IS_ARRAY(s) && !hasSameOriginalName(s) && s->variant() == VARIABLE_NAME && !IS_ALLOCATABLE(s) && !IS_POINTER_F90(s) && !HEADER(s) )
InsertNewStatementBefore(DataExit(new SgVarRefExp(s),0),st); InsertNewStatementBefore(DataExit(new SgVarRefExp(s),0),st);
s = s->next(); s = s->next();
} }

View File

@@ -2513,7 +2513,7 @@ void fillInterfaceBlock(map<string, vector<FuncInfo*>>& allFuncInfo)
for (auto& byFile : allFuncInfo) for (auto& byFile : allFuncInfo)
{ {
for (auto& func : byFile.second) for (auto& func : byFile.second)
{ {
for (auto& interface : func->interfaceBlocks) for (auto& interface : func->interfaceBlocks)
{ {
auto itF = mapOfFunc.find(interface.first); auto itF = mapOfFunc.find(interface.first);
@@ -2534,6 +2534,13 @@ void fillInterfaceBlock(map<string, vector<FuncInfo*>>& allFuncInfo)
} }
} }
} }
//filted interfaces
map<string, FuncInfo*> copy = func->interfaceBlocks;
func->interfaceBlocks.clear();
for (auto& interface : func->interfaceBlocks)
if (interface.second)
func->interfaceBlocks[interface.first] = interface.second;
} }
} }

View File

@@ -489,6 +489,9 @@ static SgSymbol* getParameter(SgStatement* stat, int n)
static void intentInsert(const FuncInfo* func, SgStatement* headerSt) static void intentInsert(const FuncInfo* func, SgStatement* headerSt)
{ {
if (func == NULL)
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
if (func->funcPointer->variant() == ENTRY_STAT) if (func->funcPointer->variant() == ENTRY_STAT)
return; return;