-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DebugInfo] Support for non-contiguous assumed shape array #926
Closed
Conversation
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
Note: This modification makes use of recent upgrade to DISubrange https://reviews.llvm.org/rGd20bf5a7258d4b6a7f017a81b125275dac1aa166 Currently flang generates 0 sized DISubrange metadata for assumed sahpe arrays. --------- test case --------- subroutine sub(assume,n1,n2) dimension assume(n1,n2) end subroutine sub ------- LLVM IR ------- !29 = !DILocalVariable(name: "assume", arg: 1, scope: !26, file: !3, type: !30) !30 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 32, align: 32, elements: !31) !31 = !{!32, !32} !32 = !DISubrange(count: 0, lowerBound: 1) ------- This is fixed by upgrading DISubrange as it is upgraded in LLVM to be able to dump proper DISubrange for assumed shape array. ------- !29 = !DILocalVariable(name: "assume", arg: 1, scope: !26, file: !3, type: !30) !30 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 32, align: 32, elements: !31) !31 = !{!32, !36} !32 = !DISubrange(lowerBound: 1, upperBound: !33) !33 = distinct !DILocalVariable(scope: !34, file: !3, type: !35, flags: DIFlagArtificial) !36 = !DISubrange(lowerBound: 1, upperBound: !37) !37 = distinct !DILocalVariable(scope: !34, file: !3, type: !35, flags: DIFlagArtificial) -------
…n debugger Note: This modification makes use of recent upgrade to DISubrange https://reviews.llvm.org/rGd20bf5a7258d4b6a7f017a81b125275dac1aa166 Now, below testcase gives desired results with debugger. -------------- program main integer, allocatable :: arr(:) allocate (arr(2:10)) arr(3) = 9 end program main -------------- (gdb) pt arr type = integer (2:10) (gdb) p arr $1 = (0, 9, 0, 0, 0, 0, 0, 0, 0) -------------- And below case works as well -------------- program main type dt integer :: var1 integer :: var2 integer, allocatable :: arr1 (:,:) integer :: var3 end type dt type(dt) :: dvar1 dvar1%var1 = 21 dvar1%var2 = 22 dvar1%var3 = 23 allocate (dvar1%arr1(2:9, 3:11)) dvar1%arr1(5,4) = 11 end program main -------------- (gdb) pt dvar1 type = Type dt integer :: var1 integer :: var2 integer :: arr1(2:9,3:11) integer :: var3 End Type dt (gdb) p dvar1%arr1 $2 = (( 0, 0, 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 11, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0, 0, 0) ) ---------------
This patch makes use of commited llvm patch [DebugInfo] Support for DW_AT_associated and DW_AT_allocated. https://reviews.llvm.org/rG2d10258a31a6d05368dfd4442c4aaa7b54614f1e This fix is needed for allocatable/pointer arrays. for pointer array (before allocation/association) Before fix ------ (gdb) pt ptr type = integer (140737345375288:140737354129776) (gdb) p ptr value requires 35017956 bytes, which is more than max-value-size ------ After fix ------ (gdb) pt ptr type = integer (:) (gdb) p ptr $1 = <not associated> ------ for allocatable array (before allocation) Before fix ------ (gdb) pt arr type = integer (140737345375288:140737354129776) (gdb) p arr value requires 35017956 bytes, which is more than max-value-size ------ After fix ------ (gdb) pt arr type = integer, allocatable (:) (gdb) p arr $1 = <not allocated> ------ Testing: - check-flang
d67d073
to
1768076
Compare
Superset PR #952 is up for review. hence closing it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request supports debugging of non-contiguous assumed shape array.
Dependency: #901, #902, #913, #925