[flang-commits] [flang] [flang][OpenMP] Skip invalid conditional compilation sentinels (PR #126282)
Leandro Lupori via flang-commits
flang-commits at lists.llvm.org
Wed Feb 12 05:49:19 PST 2025
================
@@ -1432,6 +1432,21 @@ Prescanner::IsFixedFormCompilerDirectiveLine(const char *start) const {
}
*sp++ = ToLowerCaseLetter(*p);
}
+ // A fixed form OpenMP conditional compilation sentinel must satisfy the
+ // following criteria, for initial lines:
+ // - Columns 3 through 5 must have only white space or numbers.
+ // - Column 6 must be space or zero.
+ if (column == 3 && sentinel[0] == '$') {
+ const char *q{p};
+ for (int col{3}; col < 6; ++col, ++q) {
+ if (!IsSpaceOrTab(q) && !IsDecimalDigit(*q)) {
+ return std::nullopt;
+ }
+ }
+ if (*q != ' ' && *q != '0') {
+ return std::nullopt;
+ }
----------------
luporl wrote:
I'm not sure. The spec says it must be a space or zero in column 6 and white space and numbers in columns 1 through 5:
> After the sentinel is replaced with two spaces, initial lines must have a space or zero in column 6 and only white space and numbers in columns 1 through 5;
(OpenMP 5.2 3.3.1)
My interpretation is that space is only `' '` while white space includes tab too.
https://github.com/llvm/llvm-project/pull/126282
More information about the flang-commits
mailing list