Skip to content

[Flang] No error checking for unseparated statement number and keyword in free form #156267

@ohno-fj

Description

@ohno-fj
Version of flang : 22.0.0(a5cf82c645245c4f6ed3dcc2178b8abfeed0f7d5)/AArch64

The attached program (snf_inline_2904_4_2.f90) is incorrect.
This program is free form, with no separation between statement number and keyword.

According to Fortran Standard 2023: 6.3.2.2 Blank characters in free form, a blank shall be used to separate names, constants, or labels from adjacent keywords, names, constants, or labels.

Thus, 10print in this program requires a space between 10 and print.
Flang probably needs to detect programming errors during compilation.

The following are the test program, Flang, Gfortran and ifx compilation/execution result.

snf_inline_2904_4_2.f90:

program minimal_example
  10print *, 'pass'

end program minimal_example
$ flang snf_inline_2904_4_2.f90; ./a.out
 pass
$
$ gfortran snf_inline_2904_4_2.f90
snf_inline_2904_4_2.f90:2:6:

    2 |   10print *, 'pass'
      |      1
Error: Non-numeric character in statement label at (1)
$
$ ifx snf_inline_2904_4_2.f90; ./a.out
 pass
$

Metadata

Metadata

Assignees

No one assigned

    Labels

    flang:frontendquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions