llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.82k stars 11.46k forks source link

[flang][debuginfo] Array with non constant extent is being treated as assumed size array. #98879

Open abidh opened 1 month ago

abidh commented 1 month ago

The array with explicit shape with non constant extent is being treated as assumed size array. See the following program:

PROGRAM minimal
  integer arr(-2:3)
  arr(:) = 1
  print *, arr
  call change(arr, 6)
contains
  subroutine change(a, n)
    integer :: a(n)
    a(1) = 10
    print *, a
  end subroutine change
end

When stopped in subroutine change, the type of a is shown as follows:

(gdb) ptype a
type = integer (*)
(gdb) p a
$1 = <error reading variable: failed to get range bounds>

With correct debug information, it should be possible to get the extent of this array.

llvmbot commented 1 month ago

@llvm/issue-subscribers-debuginfo

Author: Abid Qadeer (abidh)

The array with explicit shape with non constant extent is being treated as assumed size array. See the following program: ``` PROGRAM minimal integer arr(-2:3) arr(:) = 1 print *, arr call change(arr, 6) contains subroutine change(a, n) integer :: a(n) a(1) = 10 print *, a end subroutine change end ``` When stopped in subroutine `change`, the type of `a` is shown as follows: ``` (gdb) ptype a type = integer (*) (gdb) p a $1 = <error reading variable: failed to get range bounds> ``` With correct debug information, it should be possible to get the extent of this array.
llvmbot commented 1 month ago

@llvm/issue-subscribers-flang-ir

Author: Abid Qadeer (abidh)

The array with explicit shape with non constant extent is being treated as assumed size array. See the following program: ``` PROGRAM minimal integer arr(-2:3) arr(:) = 1 print *, arr call change(arr, 6) contains subroutine change(a, n) integer :: a(n) a(1) = 10 print *, a end subroutine change end ``` When stopped in subroutine `change`, the type of `a` is shown as follows: ``` (gdb) ptype a type = integer (*) (gdb) p a $1 = <error reading variable: failed to get range bounds> ``` With correct debug information, it should be possible to get the extent of this array.