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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Compilation abnormally terminates when dummy procedure name is the same as common-block-name
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:ir
      </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(f4230b4332262dffb0bd3b7a2f8d6deb2e96488e)/AArch64
```

When `dummy procedure name` is the same as `common-block-name`, a compilation terminates abnormally (Lowering to LLVM IR failed).  
There should be no problem that the dummy procedure name and common-block-name have the same name.

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

terrcom3_2.f:
```fortran
      subroutine ss5()
      common /com_dummy1/ x
      interface
         subroutine com_dummy1()
         end subroutine
      end interface
      print *,fun_sub(com_dummy1)
      end
```

```
$ flang terrcom3_2.f -c
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/MCS/fe2ferr/terrcom3_2.f":4:21): redefinition of symbol named 'com_dummy1_'
error: Lowering to LLVM IR failed
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/MCS/fe2ferr/terrcom3_2.f":2:15): LLVM Translation failed for operation: fir.global
error: failed to create the LLVM module
$
```

```
$ gfortran terrcom3_2.f -c
terrcom3_2.f:2:25:

    2 |       common /com_dummy1/ x
      |                         1
Error: COMMON block ‘com_dummy1’ at (1) cannot have the EXTERNAL attribute
$
```

```
$ ifx terrcom3_2.f -c; ls -al *.o
-rw-r--r--. 1 32800043 32800043 1136 Jan  8 02:00 terrcom3_2.o
$
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVd9vozgQ_msmL6MgM84PeMgDm5bTrdpdaa_au7fKwBDYNTiyTX_89ycT2tCmutu3RUQBMx5_38w3M8q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