From 2e2bcadfa1ad6dd4364b2a65a99013b57160e2b9 Mon Sep 17 00:00:00 2001 From: ALEXks Date: Sun, 17 Nov 2024 17:19:58 +0300 Subject: [PATCH] fixed fdvm, fixed errors with interfacesg --- dvm/fdvm/trunk/fdvm/acc.cpp | 16 ++++++++++++++-- .../Sapfor_2017/_src/GraphCall/graph_calls.cpp | 9 ++++++++- .../_src/Transformations/function_purifying.cpp | 3 +++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/dvm/fdvm/trunk/fdvm/acc.cpp b/dvm/fdvm/trunk/fdvm/acc.cpp index 5758e8e..57290d6 100644 --- a/dvm/fdvm/trunk/fdvm/acc.cpp +++ b/dvm/fdvm/trunk/fdvm/acc.cpp @@ -1237,6 +1237,18 @@ int is_deleted_module_symbol(SgSymbol *s) // deleted because it was renamed (par 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) { symb_list *sl; @@ -1250,7 +1262,7 @@ void EnterDataRegionForVariablesInMainProgram(SgStatement *st) s = cur_func->symbol()->next(); 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()); s = s->next(); } @@ -1270,7 +1282,7 @@ void ExitDataRegionForVariablesInMainProgram(SgStatement *st) s=cur_func->symbol()->next(); 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); s = s->next(); } diff --git a/sapfor/experts/Sapfor_2017/_src/GraphCall/graph_calls.cpp b/sapfor/experts/Sapfor_2017/_src/GraphCall/graph_calls.cpp index c99723f..a44543c 100644 --- a/sapfor/experts/Sapfor_2017/_src/GraphCall/graph_calls.cpp +++ b/sapfor/experts/Sapfor_2017/_src/GraphCall/graph_calls.cpp @@ -2513,7 +2513,7 @@ void fillInterfaceBlock(map>& allFuncInfo) for (auto& byFile : allFuncInfo) { for (auto& func : byFile.second) - { + { for (auto& interface : func->interfaceBlocks) { auto itF = mapOfFunc.find(interface.first); @@ -2534,6 +2534,13 @@ void fillInterfaceBlock(map>& allFuncInfo) } } } + + //filted interfaces + map copy = func->interfaceBlocks; + func->interfaceBlocks.clear(); + for (auto& interface : func->interfaceBlocks) + if (interface.second) + func->interfaceBlocks[interface.first] = interface.second; } } diff --git a/sapfor/experts/Sapfor_2017/_src/Transformations/function_purifying.cpp b/sapfor/experts/Sapfor_2017/_src/Transformations/function_purifying.cpp index 32a3771..28d454f 100644 --- a/sapfor/experts/Sapfor_2017/_src/Transformations/function_purifying.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Transformations/function_purifying.cpp @@ -489,6 +489,9 @@ static SgSymbol* getParameter(SgStatement* stat, int n) static void intentInsert(const FuncInfo* func, SgStatement* headerSt) { + if (func == NULL) + printInternalError(convertFileName(__FILE__).c_str(), __LINE__); + if (func->funcPointer->variant() == ENTRY_STAT) return;