[flang-commits] [flang] [flang][NFC] Fix build-time warning (PR #149549)

via flang-commits flang-commits at lists.llvm.org
Fri Jul 18 09:43:16 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: Peter Klausler (klausler)

<details>
<summary>Changes</summary>

Don't increment the LHS variable of an assignment that also uses that variable on the RHS.

---
Full diff: https://github.com/llvm/llvm-project/pull/149549.diff


1 Files Affected:

- (modified) flang/lib/Semantics/resolve-labels.cpp (+3-4) 


``````````diff
diff --git a/flang/lib/Semantics/resolve-labels.cpp b/flang/lib/Semantics/resolve-labels.cpp
index 27e259fab38738..9454ef9fe928ad 100644
--- a/flang/lib/Semantics/resolve-labels.cpp
+++ b/flang/lib/Semantics/resolve-labels.cpp
@@ -492,10 +492,9 @@ class ParseTreeAnalyzer {
     // Uppercase the name of the main program, so that its symbol name
     // would be unique from similarly named non-main-program symbols.
     auto upperCaseCharBlock = [](const parser::CharBlock &cb) {
-      char *ch{const_cast<char *>(cb.begin())};
-      char *endCh{ch + cb.size()};
-      while (ch != endCh) {
-        *ch++ = parser::ToUpperCaseLetter(*ch);
+      auto ch{const_cast<char *>(cb.begin())};
+      for (char *endCh{ch + cb.size()}; ch != endCh; ++ch) {
+        *ch = parser::ToUpperCaseLetter(*ch);
       }
     };
     const parser::CharBlock *progName{nullptr};

``````````

</details>


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


More information about the flang-commits mailing list