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