diff --git a/flang/lib/Parser/prescan.cpp b/flang/lib/Parser/prescan.cpp index 3bc2ea0b37508..2aeb2a81308cd 100644 --- a/flang/lib/Parser/prescan.cpp +++ b/flang/lib/Parser/prescan.cpp @@ -564,7 +564,7 @@ bool Prescanner::MustSkipToEndOfLine() const { return true; // skip over ignored columns in right margin (73:80) } else if (*at_ == '!' && !inCharLiteral_ && (!inFixedForm_ || tabInCurrentLine_ || column_ != 6)) { - return !IsCompilerDirectiveSentinel(at_); + return !IsCompilerDirectiveSentinel(at_ + 1); } else { return false; } diff --git a/flang/test/Preprocessing/bug117693.F90 b/flang/test/Preprocessing/bug117693.F90 new file mode 100644 index 0000000000000..531c07417d0f1 --- /dev/null +++ b/flang/test/Preprocessing/bug117693.F90 @@ -0,0 +1,14 @@ +! RUN: %flang -fopenmp -E %s 2>&1 | FileCheck %s +! CHECK: !$OMP PARALLEL DO +! CHECK: !$OMP END PARALLEL DO +program main +IMPLICIT NONE +INTEGER:: I +#define OMPSUPPORT +INTEGER :: omp_id +OMPSUPPORT !$OMP PARALLEL DO +DO I=1,100 +print *, omp_id +ENDDO +OMPSUPPORT !$OMP END PARALLEL DO +end program