[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 Sep 17 15:46:02 PDT 2026
================
@@ -0,0 +1,10 @@
+! Check that -E also enables preprocessing.
+! RUN: %flang_fc1 -cpp -fsyntax-only %s
+! RUN: %flang -E %s 2>&1 | FileCheck %s
+! RUN: %flang -E -nocpp %s 2>&1 | FileCheck %s --check-prefix=NOCPP
----------------
eugeneepshteyn wrote:
(Reasonable suggestion from AI agent)
This NOCPP check is a false positive: with `2>&1`, the pattern on line 7 matches the *label-field warning's echo of the source line on stderr*, not the preprocessed output. The actual `-E -nocpp` stdout has the comments blanked, so the check can never match there:
```console
$ flang -E -nocpp fixed-c-comment04.f 2>/dev/null
#line "fixed-c-comment04.f" 8
print *, "hello"
+, "world"
end
```
So the test passes on stderr alone and would fail on stdout alone — it doesn't verify what it says it checks, and it would keep passing if `-E -nocpp` behavior regressed.
Suggested fix: drop the `2>&1` on this RUN line (use `2>/dev/null`) and pin what stdout actually contains (e.g. `print *,` and the unjoined `+, "world"` line) — or, if the intent is that `-E -nocpp` preserves the comment text literally, the implementation doesn't do that today and the test is masking it.
https://github.com/llvm/llvm-project/pull/207012
More information about the flang-commits
mailing list