<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55841>55841</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Fix argument mismatch issue
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kiranchandramohan
</td>
</tr>
</table>
<pre>
When functions in different modules have the same name, it causes semantic checks to be confused. Using the wrong function signature for checks can cause the arguments to be mismatched. A reproducer is given below.
```
module aString
implicit none
Type string
character(len=1),dimension(:),pointer :: c
End Type string
interface clean; module procedure clean_; end interface
contains
subroutine clean_(str)
implicit none
type(string), intent(inout) :: str
end subroutine clean_
end module
module aList
implicit none
Type list
character(len=1),dimension(:),pointer :: bf
integer, dimension(:,:),pointer :: lc
End Type list
interface clean; module procedure clean_; end interface
contains
subroutine clean_(aList, stat)
implicit none
type(list), intent(inout) :: aList
integer, optional, intent(out) :: stat
end subroutine clean_
end module
module tmp_mod
use aString ,only: a_string => string
use aString ,only: a_string_clean => clean
use aList ,only: a_list => list
use aList ,only: a_list_clean => clean
end module
module flds
use tmp_mod
implicit none
contains
subroutine sb()
type(a_string) :: tmpOStr
type(a_list) :: tmpIstr
call a_list_clean(tmpIstr)
call a_string_clean(tmpOStr)
end subroutine
end module
```
This issue was found while investigating 527.cam4_r.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVcmO2zAM_RrnQjTI2HGWgw-zAgUK9NAWPQayLNvqyFIgyUnn70tJXjGeQTfD8CKST4-LyFwVL9n3mkkoW0ktV9IAl1DwsmSaSQuNKlrBDNTkwsDWDAxpGEh8RPE9cAuUtAblhjVEWk6B1ow-G7AKcgZUyRLFxRq-GS4rD3DVCr_67cDwShLbagal0r01JTIAewuiq7ZBMj1qw01DLKoi7i1odtZIkjIN3EDFL-hMzoS6rqPNQ7S57Z67TXf73-AWkC9WI6-wBsC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