From 49d3b9b96ebd063e1b31455441d3a43ad1a87402 Mon Sep 17 00:00:00 2001 From: xnpster Date: Mon, 15 Sep 2025 21:25:57 +0300 Subject: [PATCH] REMOVE_DIST_ARRAYS_FROM_IO: revert hotfix for issue with generated intent statements --- .../replace_dist_arrays_in_io.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp b/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp index 827e0db..aeda7d3 100644 --- a/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp +++ b/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp @@ -17,19 +17,6 @@ using std::pair; #define DEBUG_TRACE 0 -static SgStatement* getDeclStatement(int line_num) -{ - PTR_BFND node = current_file->firstStatement()->thebif; - for (; node; node = node->thread) - { - SgStatement *st = BfndMapping(node); - if (st->lineNumber() == line_num && isSgDeclarationStatement(st)) - return st; - } - - return NULL; -} - static SgExpression* findExprWithVariant(SgExpression* exp, int variant) { if (exp) @@ -134,7 +121,7 @@ static bool checkAssumedSize(const string &array_name, DIST::Array* array_p, con if (!switchToDeclarationFile(array_p, decl_place, current_file_name, current_func)) return true; - auto *st = getDeclStatement(decl_place.second); + auto *st = SgStatement::getStatementByFileAndLine(decl_place.first, decl_place.second); if (!st) printInternalError(convertFileName(__FILE__).c_str(), __LINE__); @@ -666,7 +653,8 @@ void replaceDistributedArraysInIO(vector& regions, // original declaration statement - auto* decl_stmt = getDeclStatement(decl_place.second); + auto *decl_stmt = SgStatement::getStatementByFileAndLine(decl_place.first, decl_place.second); + if (!decl_stmt || !isSgDeclarationStatement(decl_stmt)) printInternalError(convertFileName(__FILE__).c_str(), __LINE__);