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

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Thu Jul 2 17:05:41 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:

Ok, what about files with continuation lines without C comments? Wouldn't `SkipCComment()` just keep fruitlessly searching till the end of file for the comment termination? Try this file (remove .txt): 
[cont50.f.txt](https://github.com/user-attachments/files/29616651/cont50.f.txt)


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


More information about the flang-commits mailing list