-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DebugInfo] Debug support for array parameters with pointer/allocatab…
…le attribute
- Loading branch information
1 parent
19e48bb
commit 67f9180
Showing
5 changed files
with
129 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
!RUN: %flang -gdwarf-4 -S -emit-llvm %s -o - | FileCheck %s | ||
|
||
!CHECK-LABEL: define void @callee_ | ||
!CHECK: call void @llvm.dbg.declare(metadata i64* %"array$p", metadata [[DLOC:![0-9]+]] | ||
!CHECK-NEXT: call void @llvm.dbg.declare(metadata i64* %"array$p", metadata [[ALLOCATED:![0-9]+]] | ||
!CHECK-NEXT: call void @llvm.dbg.declare(metadata i64* %"array$sd", metadata [[ARRAY:![0-9]+]], metadata !DIExpression()) | ||
!CHECK: [[ARRAY]] = !DILocalVariable(name: "array", arg: 1, | ||
!CHECK-SAME: type: [[TYPE:![0-9]+]] | ||
!CHECK: [[TYPE]] = !DICompositeType(tag: DW_TAG_array_type, | ||
!CHECK-SAME: dataLocation: [[DLOC]], allocated: [[ALLOCATED]] | ||
|
||
subroutine callee (array) | ||
integer, allocatable :: array(:, :) | ||
integer :: local = 4 | ||
|
||
do i=LBOUND (array, 2), UBOUND (array, 2), 1 | ||
do j=LBOUND (array, 1), UBOUND (array, 1), 1 | ||
write(*, fmt="(i4)", advance="no") array (j, i) | ||
end do | ||
print *, "" | ||
end do | ||
|
||
local = local / 2 | ||
print *, "local = ", local | ||
end subroutine callee | ||
|
||
program caller | ||
|
||
interface | ||
subroutine callee (array) | ||
integer, allocatable :: array(:, :) | ||
end subroutine callee | ||
end interface | ||
|
||
integer, allocatable :: caller_arr(:, :) | ||
allocate(caller_arr(10, 10)) | ||
caller_arr = 99 | ||
caller_arr(2,2) = 88 | ||
call callee (caller_arr) | ||
print *, "" | ||
end program caller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
!RUN: %flang -gdwarf-4 -S -emit-llvm %s -o - | FileCheck %s | ||
|
||
!CHECK-LABEL: define internal void @main_callee | ||
!CHECK: call void @llvm.dbg.declare(metadata i64* %callee_ptr, metadata [[CALLEE_PTR:![0-9]+]] | ||
!CHECK: [[CALLEE_PTR]] = !DILocalVariable(name: "callee_ptr", arg: 1 | ||
|
||
program main | ||
pointer (ptr, b) | ||
integer :: a(10), b(10) | ||
a = (/1,2,3,4,5,6,7,8,9,10/) | ||
call callee(ptr) | ||
print *, b | ||
print *, a | ||
print *, ptr | ||
contains | ||
subroutine callee(callee_ptr) | ||
pointer(callee_ptr, callee_pte) | ||
integer, allocatable :: callee_pte(:) | ||
allocate (callee_pte(10)) | ||
callee_pte = (/5,4,5,4,5,4,5,4,5,4/) | ||
print *,callee_ptr | ||
print *,callee_pte | ||
end subroutine | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
!RUN: %flang -gdwarf-4 -S -emit-llvm %s -o - | FileCheck %s | ||
|
||
!CHECK-LABEL: define void @callee_ | ||
!CHECK: call void @llvm.dbg.declare(metadata i64* %"array$p", metadata [[DLOC:![0-9]+]] | ||
!CHECK-NEXT: call void @llvm.dbg.declare(metadata i64* %"array$p", metadata [[ASSOCIATED:![0-9]+]] | ||
!CHECK-NEXT: call void @llvm.dbg.declare(metadata i64* %"array$sd", metadata [[ARRAY:![0-9]+]], metadata !DIExpression()) | ||
!CHECK: [[ARRAY]] = !DILocalVariable(name: "array", arg: 1, | ||
!CHECK-SAME: type: [[TYPE:![0-9]+]] | ||
!CHECK: [[TYPE]] = !DICompositeType(tag: DW_TAG_array_type, | ||
!CHECK-SAME: dataLocation: [[DLOC]], associated: [[ASSOCIATED]] | ||
|
||
subroutine callee (array) | ||
integer, pointer :: array(:, :) | ||
integer :: local = 4 | ||
|
||
do i=LBOUND (array, 2), UBOUND (array, 2), 1 | ||
do j=LBOUND (array, 1), UBOUND (array, 1), 1 | ||
write(*, fmt="(i4)", advance="no") array (j, i) | ||
end do | ||
print *, "" | ||
end do | ||
|
||
local = local / 2 | ||
print *, "local = ", local | ||
end subroutine callee | ||
|
||
program caller | ||
|
||
interface | ||
subroutine callee (array) | ||
integer, pointer :: array(:, :) | ||
end subroutine callee | ||
end interface | ||
|
||
integer, pointer :: caller_arr(:, :) | ||
integer, target :: tgt_arr(10,10) | ||
tgt_arr = 99 | ||
tgt_arr(2,2) = 88 | ||
|
||
caller_arr => tgt_arr | ||
call callee (caller_arr) | ||
|
||
print *, "" | ||
end program caller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters