From 31627756179835a88454afa0d3c376ff16c513a1 Mon Sep 17 00:00:00 2001 From: Aadesh PremKumar Date: Tue, 22 Jul 2025 17:42:12 +0530 Subject: [PATCH] --Fix for issue #127426 --- flang/lib/Parser/prescan.cpp | 1 + flang/test/Parser/inc.h | 4 ++++ flang/test/Parser/test.F | 14 ++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 flang/test/Parser/inc.h create mode 100644 flang/test/Parser/test.F diff --git a/flang/lib/Parser/prescan.cpp b/flang/lib/Parser/prescan.cpp index 3a9a475c365ee..ceb3d91c216cc 100644 --- a/flang/lib/Parser/prescan.cpp +++ b/flang/lib/Parser/prescan.cpp @@ -435,6 +435,7 @@ void Prescanner::LabelField(TokenSequence &token) { int outCol{1}; const char *start{at_}; std::optional badColumn; + SkipCComments(); for (; *at_ != '\n' && column_ <= 6; ++at_) { if (*at_ == '\t') { ++at_; diff --git a/flang/test/Parser/inc.h b/flang/test/Parser/inc.h new file mode 100644 index 0000000000000..a754bfbbbc641 --- /dev/null +++ b/flang/test/Parser/inc.h @@ -0,0 +1,4 @@ +/* Old style C comments +*comments +*/ +#define VAL 1 diff --git a/flang/test/Parser/test.F b/flang/test/Parser/test.F new file mode 100644 index 0000000000000..94436d70faa05 --- /dev/null +++ b/flang/test/Parser/test.F @@ -0,0 +1,14 @@ +! RUN: %flang_fc1 -fdebug-unparse-no-sema %s 2>&1 | FileCheck %s + +!CHECK: SUBROUTINE foo +!CHECK: INTEGER i +!CHECK: i = 1 +!CHECK: PRINT *, i +!CHECK: END SUBROUTINE foo + + subroutine foo () +#include "inc.h" + integer :: i + i = VAL + print *,i + end subroutine foo