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

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Wed Jul 1 17:50:55 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 ==
----------------
eugeneepshteyn wrote:

`SkipCComment()` skips to the end of the C comment, right? Then in case of a large multi-line comment, would it re-scan to the end of the comment for each line? O(n^2)?

Also, what happens for non-terminated C comment, which happens to go from here to the end of file? (Maybe can craft a test for this case.)

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


More information about the flang-commits mailing list