This PR adds debug support for allocatable. The allocatable arrays use the existing functionality to read the array information from descriptor. The allocatable for the scalar shows up as pointer to the scalar. While testing this, I notices that values of allocated and associated flags were swapped. This is also fixed in this PR. Here is how the debugging of the allocatable looks like with this patch in place. integer, allocatable :: ar1(:, :) real, allocatable :: sc allocate(sc) allocate(ar1(3, 4)) (gdb) ptype ar1 type = integer, allocatable (3,4) (gdb) p ar1 $1 = ((5, 6, 7) (9, 10, 11) (13, 14, 15) (17, 18, 19)) (gdb) p sc $2 = (PTR TO -> ( real )) 0x205300 (gdb) p *sc $3 = 3.1400001
25 lines
931 B
Fortran
25 lines
931 B
Fortran
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s
|
|
|
|
subroutine ff(n, m)
|
|
integer n, m, i, j
|
|
integer, allocatable :: ar1(:, :)
|
|
real, allocatable :: sc
|
|
|
|
allocate(ar1(n, m))
|
|
allocate(sc)
|
|
sc = 3.14
|
|
|
|
print *, sc
|
|
print *, ar1
|
|
end subroutine ff
|
|
|
|
|
|
! CHECK-DAG: !DILocalVariable(name: "ar1"{{.*}}type: ![[TY1:[0-9]+]])
|
|
! CHECK-DAG: ![[TY1]] = !DICompositeType(tag: DW_TAG_array_type{{.*}}elements: ![[ELEMS2:[0-9]+]]{{.*}}dataLocation{{.*}}allocated: !DIExpression(DW_OP_push_object_address, DW_OP_deref, DW_OP_lit0, DW_OP_ne))
|
|
! CHECK-DAG: ![[ELEMS2]] = !{![[ELEM1:[0-9]+]], ![[ELEM2:[0-9]+]]}
|
|
! CHECK-DAG: ![[ELEM1]] = !DISubrange
|
|
! CHECK-DAG: ![[ELEM2]] = !DISubrange
|
|
! CHECK-DAG: !DILocalVariable(name: "sc"{{.*}}type: ![[TY2:[0-9]+]])
|
|
! CHECK-DAG: ![[TY2]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[TY3:[0-9]+]]{{.*}})
|
|
! CHECK-DAG: ![[TY3]] = !DIBasicType(name: "real"{{.*}})
|