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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Intrinsics leaking when USEing a MODULE
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          mjklemm
      </td>
    </tr>
</table>

<pre>
    When compiling this code:

```Fortran
subroutine sub()
    use iso_c_binding
    implicit none
    integer :: kind
end subroutine
```

flang complains about `kind` being already defined. (I understand that using variable names that are now used by Fortran is bad style, but that kind of code is out there in the wild.)

It seems like that this is coming from the `kind` intrinsic being used to define `c_size_t' as `kind(c_sizeof(1))`.  In the `.mod` file, then the intrinsic (and also `achar`) is being declared:

```
> cat include/flang/iso_c_binding.f18.mod
!mod$ v1 sum:dc8d285f9386572c
module iso_c_binding
[...]
intrinsic::kind
[...]
intrinsic::achar
[...]
end
```

This seems like a bug, as other compiler happily accept `integer kind`.  Would it be possible to avoid this kind of leaking symbol names?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VMuO4zYQ_Br60liBokxZPuiwG4-BARLkkCz2OOCjZXGHIg0-ZuB8fUDKj0kwCWDIkrqbXdVVahGjOTnEkfBvhB82IqfZh3H5-WpxWTbS68v4Y0YHyi9nY407QZpNBOU1ku4roQdCb9eerr-jDykIt76NWQafk3EIMUvCBsL2awQAIEcEE_2LepHGaeNOj5BZztYok8B5hx9eu4QnDFCad1_h1Ti9BtFpeDT7F6SPOCcr3KnyscK4CEL6nID0tJ7VU5BYaAobUOgLaJyMQ90AYcMzZKcxxCSchjSLBDmW3DcRjJAWwYkF4xoRAcH590JRg7zAdSpgIkihIaaLRcJ-AZnTWlDag5_qaEuWrwEMCMaVG3g3Vjf38a3X5wQRcYlgzSuu51R9qkRLwTYFv9TyDwyNS8G4aNSVa8WY_JVryVQv0fyFL4mwHYh4r2XDGvATYUNbsLA96WkD8OxuTZrF1yaTWQmmYp8Se3QlbCgTFDb6UiHULEJRie3reComjcqKgPq_XHZ97J5AiQTGKZs1Enas8hJ2_IetmqkdKq61iLXlnm3hrYWYF9J91WrQbODTvht6vmNqTVy8zvZThxL-rWkawg_r453aasuHK_8_byX-WSLeD_jMwn8WiT_oLkDmU5m1iOCLZ66fKwaYxfls7AWEUniuNr99QVczNAA_fLYaTAKJcPYxmmLl5EG8eaNXP93MaVG8FnXiZZHern4n3XGjx07vu73Y4NjuKN-3nFO-mUfeCqRsJxTf9S2XatgNbEt71fVDP2k5bczIKNvSljG6Z5zyZida2fOJ9VtKu37QZEtxEcY21r4tjQ-njYkx47gb9rzbWCHRxrq9GLtKz8oiC2PJ_yLzKZIttSam-DghmWTryjvWCn6A55sw8U7xvfj2-x9PdRnAb78fvv_6tMnBjnNK51gEZEfCjieT5iwb5RfCjqXD9e_LOfifqFK1YswYCTtWzH8HAAD__5Owss8">