[flang-commits] [flang] [flang] Accept C-style comments in label fields (PR #207012)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Fri Jul 3 07:36:15 PDT 2026


================
@@ -1366,12 +1400,19 @@ const char *Prescanner::FixedFormContinuationLine(bool atNewline) {
   }
   tabInCurrentLine_ = false;
   char col1{*nextLine_};
+  int trailingSpaces{0};
+  for (int i{4}; i > 0 && nextLine_[i] == ' '; --i) {
+    ++trailingSpaces;
+  }
+  bool CCommentAndSpaces{!HasTabInLabelField(nextLine_) &&
+      SkipCComment(SkipWhiteSpace(nextLine_)) - nextLine_ + trailingSpaces ==
----------------
luporl wrote:

Right, `SkipCComment()` would search for the comment termination until the end of file. I guess I didn't notice that it doesn't check for a valid comment start.
I changed this part to call `SkipCComment()` only when `IsCComment()` is true.

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


More information about the flang-commits mailing list