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

    <tr>
        <th>Summary</th>
        <td>
            [flang] Variable name collision
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          lstanisi-amd
      </td>
    </tr>
</table>

<pre>
    Fortran standards question (and possibly a bug report for flang-new) -  should this be allowed?

The following code compiles with gfortran, ifort, nvfortran, but not flang-new:
```
module precisions
  use, intrinsic :: iso_fortran_env, only: real64
  integer, parameter :: gp = real64
end module precisions

module test
  use precisions
contains
  subroutine t()
    complex(kind=gp) :: a, gp
  end subroutine t
end module test
```

Compilation error:
```
$ flang-new -c  reproducer.F90
error: Semantic errors in reproducer.F90
./reproducer.F90:10:18: error: Forward reference to 'gp' is not allowed in the same specification part
      complex(kind=gp) :: a, gp
                   ^^
./reproducer.F90:10:28: Later declaration of 'gp'
      complex(kind=gp) :: a, gp
```

Choosing variable name `gp` here is definitely not the best programming practice, but an app I am working on has this, and I am not sure if it is a code or a compiler bug?

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVNGuozYQ_RrnZZQITBLggYftpkiV-taqr6sBD-CusenYJL1_X9kkN_fe3VXVRsgx9vj4zJnhoPd6tESNOP0kTpcdrmFy3Bgf0Gqv9zirXefUS9M6DowW4oZCVh7-WskH7SwIWaFVsDjvdWdeAKFbR2BaHAcYHMNg0I57Szcha9gD-MmtRkGYtIeOAI1xN1KiaEV2Edmnbfx9Ihhc3NJ2hN4pgt7Nizbk4abDBOOwURLyM-g4jxN7fbParQGsC2_uL-7g4pzdn_Q6O7UagoWp114767dlgNVTgreBtfW6h4hQfALt3Zf7RV_IXmOMs-YlbjGhOR8fANoGGoljwIKMMwXiB8i4gCgu7w6QVfADMu-YBvLhDcdvgntnA-pnHn7t2K1BW4IgZCVk_diBpKqhv4WsvmqrRHEZl1inO0mM1MflER4JvgP7SPvJ7IPG2_g5lRBT3xCz4x-VRMjjs26w7yE2FDu19sSHtr5HPSDgN5rRBt1voB60_W78Qcj2w3rxKU9DFWFe8VrHN2QFTAMx2Z4gOBCyjNqUoH3qq3vjxsvCROBxJvAL9XrQ_ZbighyeSv9Hrb_5idPP8fmXTGTK5FeMnaaoN8gbFze8JvA_KX2_opNzPn6iV2SNnSGwUQdxzsZFnDOYiCkKpmjQVgcyL0m7KFhHPsDCbmSc5wixMPZB9_T4eNECLgv8AjjDzfHXGOMsTOiTecSw6DxpP4L6Nd41gA7xRtxcw3GaJevgaE2vRrNTTaHqosYdNXlZyKwuq7zcTY0iVdTdsR6qqiSJWFSDrFReU5mXUmbFTjcyk8c8l1me5edTeSjrc11TSV19Pg4ndRTHjGbU5mDMdT44Hnfa-5WaPD_Xx3pnsCPjk-lKmdpcSBn9l5t4YN-toxfHzGgf_BMi6GCSU28nThf4453mvTMmucBuZdNMISw-llG2QrajDtPaHXo3C9lGxPvffmH3J_VByDYx9EK2d5LXRv4TAAD__5US5e8">