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

    <tr>
        <th>Summary</th>
        <td>
            [flang][debug] Wrong signature for function returning derived types.
        </td>
    </tr>

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

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

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

<pre>
    Consider the following code

```
module mod
    type cart
 integer :: x1
    end type
contains
    type(cart) function build(x)
        integer :: x
        build%x1 = x
    end function
end module

program function_calls
    use mod
 implicit none
    type(cart) :: b
    b = build(4)
    print *, b
end program
```
This is what GDB shows for the type of the build function. Notice return type and first argument.

```
(gdb) ptype mod::build
type = void (Type cart, integer)
```
This seems to be done in `AbstractResultOpt` pass but debug info needs to have the function signature as it was in the source.


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VMuO2zoM_Rp5Q0xgy3FiL7zITJC7uwWKAbosZIm2VciSoUcy8_eFZOdVTBsEUUQdUjyHpJhzctCILaleCaWsk2IklJLqmLHgR2PbZMo6Iz7bN6OdFGjBjwi9UcpcpB6AG4EkP5L8sP7u8vWbtpMRQSFMRix7AAD_OSNwZv1qktrjgBZIeSDlAT6KOxS1SPDFwo32TGr3HIrQOgWjDfRBcy-Nhi5IJQitPwht7uj4-fOy59PVr_oogJTHx9OYyTX8Yo2Whd4j_9mawbLphv3JmVIPGQf3qIacZiW59KCNxr_SWnPt7oAupXdluX1iOVupPRB6IPTt6hNzXTP7skzvo3QgHVxG5uG_4yu40Vwc9GYpd6qY6dP_dOmN3gb-N15yBIs-WL0gWdRKWueB2SFMqP3mHy1CaD2ILvKck3dUJxFe6CVMOoiUz0YKILR-v_UQfbvW9KbCV-Qc4uTAG-gQhNEIUgPZ5YfOecu4_44uKP9t9mSXw8ycgy54ENiFAaTuDWhEkfxHdsZlBq7NFoeI-WARmAPp4RIXnTDOBMvxiX0m2lI0ZcMybIs9bWjVNHSfjW25E3Wza1jZ901T5Dte06JjBd9XjNL9rsxkS3O6LfKiLsqq3u43vCq6Zl_XvMCc16wn2xwnJtVGqfO0MXbIpHMB26KgTU4zxTpUbh32XjE9rMNu2-jw0oXBkW2upPPuHsJLr9ILsXhUR1K9Jl1IdYQf1ujhQYDYMDddlpaIj4RAK8-4jLLbZMGqdvR-drHO9EToaZB-DN2Gm4nQU7x6XV5ma34h94SeEhVH6Gllc27p7wAAAP__AX9yFQ">