[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
================
@@ -0,0 +1,62 @@
+! RUN: %flang_fc1 -fsyntax-only %s 2>&1
+! RUN: %flang -E %s 2>&1 | FileCheck %s
+! RUN: not %flang_fc1 -pedantic -Werror -fdebug-dump-parse-tree-no-sema %s 2>&1 | FileCheck %s --check-prefix=ERROR
+
+ integer :: i
+
+! CHECK-NOT: C comment
+! CHECK: i = 1
+! ERROR: portability: nonstandard usage: C-style comment
+/* Old style C comments
+ *comments
+ */
+#define VAL 1
+
+! ERROR: portability: nonstandard usage: C-style comment
+/* Single-line C comment */
+ /* Single-line C comment */
+ /* Single-line C comment */
+ /* Single-line C comment */
+ /* Single-line C comment */
+ /* Single-line C comment */
+ /* Single-line C comment */
+ /* Single-line C comment */
+ i = VAL
+
+! CHECK-NOT: /*
+! CHECK-NOT: Multi
+! CHECK-NOT: C comment
+! CHECK-NOT: */
+! CHECK: i = 2
+/*
+ * Multi-line C comment
+ * comment
+ */
+ /* Multi-line
+C comment */
+ i = 2
+
+! CHECK: i = 3
+! CHECK: i = 4
+! CHECK: 9 i = 5+ 6
+/* C comment + statement */ i = 3
+ /* C comment + statement */ i = 4
+/**/90i = 5
+/**/ + + 6
----------------
eugeneepshteyn wrote:
+1
https://github.com/llvm/llvm-project/pull/207012
More information about the flang-commits
mailing list