| Issue |
177098
|
| Summary |
Free-form parsing: missing token separation diagnostics for keywords + identifiers
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
ravurvi20
|
Flang currently accepts invalid free-form Fortran constructs where keywords are not separated from adjacent identifiers or constants. According to Fortran free-form tokenization rules [ (Fortran-doc, Section 6.3.2)](https://j3-fortran.org/doc/year/25/25-007r1.pdf), a blank space or a separator is required between a keyword and the following token. Flang instead tokenizes these as ordinary identifiers.
Example -
```
program main
real_a(10), realb(5)
end program
```
Here, real is considered as keyword and `_a` and `realb` are considered identifiers, which is incorrect and should throw an error. There must be a separator like a space or `::`.
With `-pedantic`, Flang emits a warning, but the warning is too general and is also triggered by valid Fortran constructs. According to the documentation these are the keywords where **separating blanks are optional**.
Examples of additional -pedantic warnings:
```
ENDSUBROUTINE
ENDTEAM
BLOCKDATA
ELSEIF
ELSEWHERE
```
These are legitimate combined tokens in Fortran and should not be treated the same way as missing-token-separation cases involving type keywords.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs