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

    <tr>
        <th>Summary</th>
        <td>
            [flang][OpenMP] "Call parameter type does not match function signature!" for private variables
        </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 the below rerproducer, the compiler asserts with the following message:

```text
> flang-new -fopenmp --offload-arch=gfx90a -c bad_signature_reproducer.f90 -o bad_signature_reproducer.o
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
Call parameter type does not match function signature!
  %omp.private.alloc = alloca i32, align 4, addrspace(5)
 ptr  call void @_QMotherProutine(ptr addrspace(5) %omp.private.alloc)
error: failed to create the LLVM module
```

This seems to be a regression that was introduced with https://github.com/llvm/llvm-project/pull/124019.

Reproducer:
```Fortran
module other
contains
    subroutine routine(i)
        implicit none
 integer(4) :: i
    end subroutine routine
end module other

module mod
 implicit none
contains
    subroutine failing(d)
        use other, only: routine
        implicit none
        integer(4) :: i, d

 !$omp target teams distribute parallel do
        do i = 1, d
 call routine(i)
        end do
    end subroutine failing
end module mod
```


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