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

    <tr>
        <th>Summary</th>
        <td>
            [flang][debug] Missing upper bound for adjustable array
        </td>
    </tr>

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

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

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

<pre>
    Consider the following code,
```
subroutine bar(adj, n, m)
  integer n, m
  real*8 adj(n:m)
  adj(n) = 7
end subroutine

program test
  real*8 foo(100)
 call bar(foo, 101, 200)
  print *, foo(1)
end program
```

`flang version 20.0.0 (https://github.com/llvm/llvm-project a2fb70523ac310af6d8a4d9663dfe7c9cd370c53)`
Compile with flang, no upper bound info in gdb
```
Breakpoint 1, bar (adj=..., n=101, m=200) at bug.f90:4
4         adj(n) = 7
(gdb) ptype adj
type = real (101:*)
```
Compile with gfortran gives,
```
Breakpoint 1, bar (adj=..., n=101, m=200) at bug.f90:4
4         adj(n) = 7
(gdb) ptype adj
type = real(kind=8) (101:200)
```

The problem is that neither DW_AT_upper_bound nor DW_AT_count is emitted for array `adj` in the DWARF.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVMGO4ygQ_Rp8Ka2FwXbwwQd3rNz2shppji1syjY9BCzAGfXfryBJz3TvXva2UWxwUUW9qvdAhqBXi9iT5oU0YyGPuDnfv2k06Skmp977s7NBK_QQN4TFGeN-arvC7BQSdiZ0IC19_OkQjsm7I2qLMElPmJDqjbAz2PS6EtYROgBoG3FF_7Qmk0dpCBsE5ABhCR8-3J8m1gHhI5wIHdAq-JUrgaDD7t3q5RUihvh5z8U5wkRF6WPHWRrzwJeXzlDRKg3swwV2r20EwoZkf2xwX0u5H7m-VH__XIy0K9zQB-0sMFrSkgJhYotxD4QPhF0Iu6w6bsdUzu5K2MWY23P4Y_fuDecIki3TiTaMy5lXVC6tErJWXdtyteBp7mbFT3RueAKVs5_dddcG4aeOG2QQufMOjn1HD5M7rAJtFwfawqqmL-BfPMofu0tV515M0sODQD6WZXmnkY-PVl0JH-_tAhlhOtZy6SjhQ03oUMPz9y_UESZSctbBHt93zC50yNPkkkiDzFaVezXcm_470k-Frovz0UsLq75h-Kci_0dlESZ-aKsIH0WOfBb5obovWvq2YRLaZPAKOkDcZASLOm7oYfz-Onx7zcy-3pm17mmd3WFjisCrjhEVLM6D9F6-A2lpAtbSpIF0oMfvw1-XktChUD1XHe9kgX114lyc6k6IYus7Vs0tXSRvVFNT0XIpmnah9dKqTqFYCt0zyuqKVZTxpmWinKeKifrEVI2CzU1LaopXqU2Z9F06vxY6hAP7qurqU10YOaEJzzvI9_kUTMcaSE2NDjH8ios6mnxb3eXdjKR5UTgdaQp_6hDSzfS73HPl6u0IUU4G700oDm_6_3YYCbtkyIGwywP1rWd_BwAA__8_2IdJ">