[flang-commits] [flang] [flang] fix possible iterator underflow (PR #115754)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Wed Nov 27 04:01:59 PST 2024


================
@@ -415,12 +415,12 @@ auto SemanticsContext::SearchScopeIndex(parser::CharBlock source)
   if (!scopeIndex_.empty()) {
     auto iter{scopeIndex_.upper_bound(source)};
     auto begin{scopeIndex_.begin()};
-    do {
+    while (iter != begin) {
----------------
kparzysz wrote:

This will skip the loop when iter == begin, which still points to a valid element.

https://github.com/llvm/llvm-project/pull/115754


More information about the flang-commits mailing list