Issue 126450
Summary [Flang] Compilation error when using ";" to write end program statement and subroutine statement on a line in free source form
Labels flang:frontend
Assignees
Reporter ohno-fj
    ```
Version of flang : 20.0.0(8aebcebd90b79b90eca828762fd3b0637e430e51)/AArch64
```

Using `";"` to write `end program` statement and `subroutine` statement on a line in `free source form` results in a compilation error.  
According to the `"6.3.2.5 Free form statement termination"` of `Fortran standard 2023`, this is correct.  
Flang should be able to compile.

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

listing08_2.f90:
```fortran
program main
  call sub1()
end program main;subroutine sub1()
end
```

```
$ flang listing08_2.f90
error: Could not parse listing08_2.f90
./listing08_2.f90:3:18: error: expected end of line
  end program main;subroutine sub1()
                   ^
$
```

```
$ gfortran listing08_2.f90; ./a.out
$
```

```
$ ifx listing08_2.f90
listing08_2.f90(3): error #5141: Program unit END statement must be the last statement on a line
end program main;subroutine sub1()
-----------------^
compilation aborted for listing08_2.f90 (code 1)
$
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to