diff --git a/src/rose/rose_build_role_aliasing.cpp b/src/rose/rose_build_role_aliasing.cpp index 60ff8384..f89c280b 100644 --- a/src/rose/rose_build_role_aliasing.cpp +++ b/src/rose/rose_build_role_aliasing.cpp @@ -2223,6 +2223,10 @@ void mergeCluster(RoseGraph &g, const ReportManager &rm, for (it2 = it; it2 != vcluster.end() && cluster.size() < MERGE_GROUP_SIZE_MAX; ++it2) { + if (it2 == vcluster.end()) { + break; + } + // cppcheck-suppress derefInvalidIteratorRedundantCheck RoseVertex v = *it2; NGHolder *h = g[v].suffix.graph.get(); assert(!g[v].suffix.haig); /* should not be here if haig */