File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -1432,6 +1432,21 @@ Prescanner::IsFixedFormCompilerDirectiveLine(const char *start) const {
14321432 }
14331433 *sp++ = ToLowerCaseLetter (*p);
14341434 }
1435+ // A fixed form OpenMP conditional compilation sentinel must satisfy the
1436+ // following criteria, for initial lines:
1437+ // - Columns 3 through 5 must have only white space or numbers.
1438+ // - Column 6 must be space or zero.
1439+ if (column == 3 && sentinel[0 ] == ' $' ) {
1440+ const char *q{p};
1441+ for (int col{3 }; col < 6 ; ++col, ++q) {
1442+ if (!IsSpaceOrTab (q) && !IsDecimalDigit (*q)) {
1443+ return std::nullopt ;
1444+ }
1445+ }
1446+ if (*q != ' ' && *q != ' 0' ) {
1447+ return std::nullopt ;
1448+ }
1449+ }
14351450 if (column == 6 ) {
14361451 if (*p == ' 0' ) {
14371452 ++p;
Original file line number Diff line number Diff line change @@ -39,4 +39,34 @@ subroutine sub(a, b)
3939C $ This is a comment line
4040c $ his is a comment line
4141* $ This is a comment line
42+
43+ ! Test non- space/ non- number char in columns 3-5 , for initial lines.
44+ ! CHECK- NOT: " comment"
45+ c $x PRINT *, "comment"
46+ c $ + PRINT *, "comment"
47+ c $ * PRINT *, "comment"
48+
49+ ! Test non- space/ non- number char in columns 3-5 , for continuation lines.
50+ ! CHECK: " msg1"
51+ ! CHECK- NOT: " comment"
52+ c $ x PRINT *, "comment"
53+ c $1 & , "comment"
54+ c $ x & , "comment"
55+ c $ +& , "comment"
56+
57+ c $ PRINT *, "msg1"
58+ c $1 & , "comment"
59+ c $ x & , "comment"
60+ c $ +& , "comment"
61+
62+ ! Test valid chars in initial and continuation lines.
63+ ! CHECK: " msg2"
64+ ! CHECK- SAME: " msg3"
65+ c $ 20 PRINT *, "msg2"
66+ c $ & , "msg3"
67+
68+ ! CHECK: " msg4"
69+ ! CHECK- SAME: " msg5"
70+ c $ 0PRINT *, "msg4",
71+ c $ + "msg5"
4272 end
You can’t perform that action at this time.
0 commit comments