diff --git a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_omp_parser.cpp b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_omp_parser.cpp index da472d8..6654abf 100644 --- a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_omp_parser.cpp +++ b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_omp_parser.cpp @@ -432,7 +432,11 @@ static vector findAllGlobalParallelRegions(SgStatement* stFunc) && dir.keys.find("end") == end) { if (sections.size() && sections.back().end == NULL) // has open parallel region + { + __spf_print(1, "wrong omp directives placed on line %d\n", st->lineNumber()); printInternalError(convertFileName(__FILE__).c_str(), __LINE__); + } + sections.push_back(dir); sections.back().start = st; } @@ -440,6 +444,11 @@ static vector findAllGlobalParallelRegions(SgStatement* stFunc) && dir.keys.find("do") == end && dir.keys.find("end") != end) { + if (!sections.size()) + { + __spf_print(1, "wrong omp directives placed on line %d\n", st->lineNumber()); + printInternalError(convertFileName(__FILE__).c_str(), __LINE__); + } sections.back().end = st; } } @@ -514,7 +523,10 @@ void parseOmpDirectives(SgFile* file, vector& currMessages) { SgForStmt* currSt = (SgForStmt*)st; if (currSt->isEnddoLoop() == 0) + { + __spf_print(1, "wrong omp directives placed\n"); printInternalError(convertFileName(__FILE__).c_str(), __LINE__); + } else parseOmpInStatement(st, getGlobalPrivate(st, globalParallelRegions), true); } diff --git a/sapfor/experts/Sapfor_2017/_src/GraphLoop/graph_loops.cpp b/sapfor/experts/Sapfor_2017/_src/GraphLoop/graph_loops.cpp index 8660aca..3ac61db 100644 --- a/sapfor/experts/Sapfor_2017/_src/GraphLoop/graph_loops.cpp +++ b/sapfor/experts/Sapfor_2017/_src/GraphLoop/graph_loops.cpp @@ -318,7 +318,7 @@ bool checkRegionEntries(SgStatement *begin, return noError; } -bool hasThisIds(SgStatement *start, set &lines, const set &IDs, const std::set* activeOps) +bool hasThisIds(SgStatement *start, set &lines, const set &IDs, const set* activeOps) { bool has = false; SgStatement *end = start->lastNodeOfStmt(); @@ -333,7 +333,8 @@ bool hasThisIds(SgStatement *start, set &lines, const set &IDs, const if (var == ENTRY_STAT) continue; - if (activeOps && activeOps->size() && activeOps->find(curr) == activeOps->end()) + if (activeOps && activeOps->size() && activeOps->find(curr) == activeOps->end() && + isSgExecutableStatement(curr)) { curr = curr->lastNodeOfStmt(); continue; diff --git a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp index 1063efb..a06ac73 100644 --- a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp @@ -509,7 +509,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne bool res = EndDoLoopChecker(file, getObjectForFileFromMap(file_name, SPF_messages)); verifyOK &= res; } - else if (curr_regime == VERIFY_INCLUDE) + else if (curr_regime == VERIFY_INCLUDES) { bool res = IncludeChecker(file, file_name, getObjectForFileFromMap(file_name, SPF_messages)); verifyOK &= res; @@ -1315,7 +1315,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne else if (curr_regime == EXTRACT_SHADOW_DIRS) commentsToInclude.clear(); else if (curr_regime == VERIFY_ENDDO || - curr_regime == VERIFY_INCLUDE || + curr_regime == VERIFY_INCLUDES || curr_regime == VERIFY_DVM_DIRS || curr_regime == VERIFY_EQUIVALENCE || curr_regime == VERIFY_COMMON || diff --git a/sapfor/experts/Sapfor_2017/_src/Sapfor.h b/sapfor/experts/Sapfor_2017/_src/Sapfor.h index 26ee059..40046f8 100644 --- a/sapfor/experts/Sapfor_2017/_src/Sapfor.h +++ b/sapfor/experts/Sapfor_2017/_src/Sapfor.h @@ -53,7 +53,7 @@ enum passes { CODE_CHECKER_PASSES, VERIFY_ENDDO, - VERIFY_INCLUDE, + VERIFY_INCLUDES, VERIFY_EQUIVALENCE, VERIFY_COMMON, VERIFY_FUNC_DECL, @@ -232,7 +232,7 @@ static void setPassValues() passNames[CALL_GRAPH] = "CALL_GRAPH"; passNames[LOOP_GRAPH] = "LOOP_GRAPH"; passNames[VERIFY_ENDDO] = "VERIFY_ENDDO"; - passNames[VERIFY_INCLUDE] = "VERIFY_INCLUDE"; + passNames[VERIFY_INCLUDES] = "VERIFY_INCLUDES"; passNames[VERIFY_EQUIVALENCE] = "VERIFY_EQUIVALENCE"; passNames[VERIFY_COMMON] = "VERIFY_COMMON"; passNames[VERIFY_OPERATORS] = "VERIFY_OPERATORS"; diff --git a/sapfor/experts/Sapfor_2017/_src/Transformations/set_implicit_none.cpp b/sapfor/experts/Sapfor_2017/_src/Transformations/set_implicit_none.cpp index 60e4c80..d08495b 100644 --- a/sapfor/experts/Sapfor_2017/_src/Transformations/set_implicit_none.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Transformations/set_implicit_none.cpp @@ -49,15 +49,16 @@ static void FindAllVars(SgExpression* expr, set& allVars, setvariant(); if (var == VAR_REF || var == ARRAY_REF || var == FUNC_CALL) { - auto s = expr->symbol(); + auto s = expr->symbol(); + const string ident(s->identifier()); if (var == FUNC_CALL /*(s->attributes() & EXTERNAL_BIT)*/) { - if (!IS_BY_USE(s) /* && s->scope() == scope*/) + if (!IS_BY_USE(s) && ident.find("::") == string::npos /* && s->scope() == scope*/) allVars.insert(s); } else { - if (!IS_BY_USE(s) && s->scope() == scope) + if (!IS_BY_USE(s) && ident.find("::") == string::npos && s->scope() == scope) allVars.insert(s); } } @@ -210,7 +211,7 @@ static map FunctionImplicitCheck(SgStatement* function, const map break; } - set skip = { EXTERN_STAT }; + set skip = { EXTERN_STAT, PRIVATE_STMT, PUBLIC_STMT }; set allDataSymbols; for (auto s = function->symbol()->next(); s; s = s->next()) diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h b/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h index 2e4d878..5952c12 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h @@ -223,11 +223,11 @@ void InitPassesDependencies(map> &passDepsIn, set Pass(PRIVATE_ANALYSIS_IR) <= Pass(LOOP_ANALYZER_NODIST); - Pass(CORRECT_VAR_DECL) <= list({ VERIFY_DVM_DIRS, VERIFY_OPERATORS, VERIFY_FORMAT, VERIFY_ENDDO, PREPROC_SPF, VERIFY_INCLUDE, PREPROC_ALLOCATES, CHECK_FUNC_TO_INCLUDE, FILL_PAR_REGIONS_LINES, CONVERT_ASSIGN_TO_LOOP, VERIFY_COMMON, VERIFY_EQUIVALENCE, PRINT_PAR_REGIONS_ERRORS }) <= Pass(CODE_CHECKER_PASSES); + Pass(CORRECT_VAR_DECL) <= list({ VERIFY_DVM_DIRS, VERIFY_OPERATORS, VERIFY_FORMAT, VERIFY_ENDDO, PREPROC_SPF, VERIFY_INCLUDES, PREPROC_ALLOCATES, CHECK_FUNC_TO_INCLUDE, FILL_PAR_REGIONS_LINES, CONVERT_ASSIGN_TO_LOOP, VERIFY_COMMON, VERIFY_EQUIVALENCE, PRINT_PAR_REGIONS_ERRORS }) <= Pass(CODE_CHECKER_PASSES); - list({ VERIFY_OPERATORS, VERIFY_ENDDO, VERIFY_INCLUDE, PREPROC_SPF, PREPROC_ALLOCATES, GET_ALL_ARRAY_DECL, GCOV_PARSER }) <= list({ CALL_GRAPH, MACRO_EXPANSION, DEF_USE_STAGE1 }); + list({ VERIFY_OPERATORS, VERIFY_ENDDO, VERIFY_INCLUDES, PREPROC_SPF, PREPROC_ALLOCATES, GET_ALL_ARRAY_DECL, GCOV_PARSER }) <= list({ CALL_GRAPH, MACRO_EXPANSION, DEF_USE_STAGE1 }); - list({ VERIFY_OPERATORS, VERIFY_ENDDO, VERIFY_INCLUDE, PREPROC_ALLOCATES, FILL_PARALLEL_REG_IR }) <= list({ GET_ALL_ARRAY_DECL, FILL_COMMON_BLOCKS, PARSE_OMP_DIRS }) <= Pass(PREPROC_SPF); + list({ VERIFY_OPERATORS, VERIFY_ENDDO, VERIFY_INCLUDES, PREPROC_ALLOCATES, FILL_PARALLEL_REG_IR }) <= list({ GET_ALL_ARRAY_DECL, FILL_COMMON_BLOCKS, PARSE_OMP_DIRS }) <= Pass(PREPROC_SPF); Pass(CHECK_PAR_REG_DIR) <= Pass(FILL_PARALLEL_REG_IR); @@ -271,7 +271,7 @@ void InitPassesDependencies(map> &passDepsIn, set Pass(REVERT_SUBST_EXPR_RD) <= list({ PURE_SAVE_TO_PARAMS, PURE_MODULE_TO_PARAMS, PURE_COMMON_TO_PARAMS, PURE_INTENT_INSERT }); - list({ CORRECT_VAR_DECL, REVERT_SUBST_EXPR_RD, VERIFY_INCLUDE }) <= list({ CONVERT_TO_ENDDO, CORRECT_CODE_STYLE, REMOVE_DVM_DIRS, REMOVE_DVM_DIRS_TO_COMMENTS, REMOVE_DVM_INTERVALS }); + list({ CORRECT_VAR_DECL, REVERT_SUBST_EXPR_RD, VERIFY_INCLUDES }) <= list({ CONVERT_TO_ENDDO, CORRECT_CODE_STYLE, REMOVE_DVM_DIRS, REMOVE_DVM_DIRS_TO_COMMENTS, REMOVE_DVM_INTERVALS }); list({ CALL_GRAPH2, CONVERT_LOOP_TO_ASSIGN, REVERT_SUBST_EXPR_RD, RESTORE_LOOP_FROM_ASSIGN }) <= Pass(INLINE_PROCEDURES); @@ -310,7 +310,7 @@ void InitPassesDependencies(map> &passDepsIn, set list({ CALL_GRAPH2, REVERT_SUBST_EXPR_RD }) <= Pass(REMOVE_DEAD_CODE); list({ REMOVE_DEAD_CODE, CONVERT_LOOP_TO_ASSIGN, RESTORE_LOOP_FROM_ASSIGN }) <= Pass(REMOVE_DEAD_CODE_AND_UNPARSE); - Pass(CORRECT_VAR_DECL) <= Pass(SET_IMPLICIT_NONE); + list({ VERIFY_INCLUDES, CORRECT_VAR_DECL }) <= Pass(SET_IMPLICIT_NONE); passesIgnoreStateDone.insert({ CREATE_PARALLEL_DIRS, INSERT_PARALLEL_DIRS, INSERT_SHADOW_DIRS, EXTRACT_PARALLEL_DIRS, EXTRACT_SHADOW_DIRS, CREATE_REMOTES, UNPARSE_FILE, REMOVE_AND_CALC_SHADOW, diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index 0039fac..64e93eb 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/version.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2355" +#define VERSION_SPF "2358"