<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/126450>126450</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Compilation error when using ";" to write end program statement and subroutine statement on a line in free source form
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:frontend
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ohno-fj
      </td>
    </tr>
</table>

<pre>
    ```
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)
$
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVMFuqzgU_Rpnc1VkroGGBQvaPmY3msXMbEfGXIKfHDuyTdv5-5GBvNKk0ryHoiRgc3zOufceGYI-WaKGlU-sfDnIOU7ON26y7mH8fujd8G_DKr59ePs3-aCdBTfCaKQ9ARMtIM94xhkej5J6Rf1Q8_6x7mtOSh7x-FjhOIieV-KRCsGpzBnWDLu29WqqCsbb_QmMt38FnZArzhCZeErfFYfo4M3rSGmB7AAX705entNSiDLSmWwEaYe0HubeuzlqS5-XnQUJRlsCbdO-0RNBcLNXBKPzC5inMJsY0g4Jyp0v2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