-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[flang] fix scoping of cray pointer declarations and add check for initialization #136776
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,64 @@ | ||
! RUN: %flang_fc1 -fdebug-dump-symbols %s 2>&1 | FileCheck %s | ||
|
||
!CHECK: Module scope: m1 | ||
!CHECK: i, PUBLIC size={{[0-9]+}} offset={{[0-9]+}}: ObjectEntity type: REAL({{[0-9]+}}) init:{{.+}} | ||
!CHECK: init, PUBLIC (Subroutine): Subprogram () | ||
!CHECK: o, PUBLIC (CrayPointee) size={{[0-9]+}} offset={{[0-9]+}}: ObjectEntity type: REAL({{[0-9]+}}) | ||
!CHECK: ptr, PUBLIC (CrayPointer) size={{[0-9]+}} offset={{[0-9]+}}: ObjectEntity type: INTEGER({{[0-9]+}}) | ||
module m1 | ||
implicit none | ||
real:: o | ||
real:: i = 42.0 | ||
pointer (ptr, o) | ||
contains | ||
!CHECK: Subprogram scope: init | ||
subroutine init | ||
implicit none | ||
ptr=loc(i) | ||
print *, "init : o= ", o | ||
end subroutine init | ||
end module m1 | ||
|
||
!CHECK: Module scope: m2 | ||
!CHECK: i, PUBLIC: Use from i in m1 | ||
!CHECK: i2, PUBLIC size={{[0-9]+}} offset={{[0-9]+}}: ObjectEntity type: REAL({{[0-9]+}}) init:{{.+}} | ||
!CHECK: init, PUBLIC (Subroutine): Use from init in m1 | ||
!CHECK: o, PUBLIC (CrayPointee): Use from o in m1 | ||
!CHECK: ptr, PUBLIC (CrayPointer): Use from ptr in m1 | ||
!CHECK: reset, PUBLIC (Subroutine): Subprogram () | ||
module m2 | ||
use m1 | ||
implicit none | ||
real:: i2 = 777.0 | ||
contains | ||
!CHECK: Subprogram scope: reset | ||
!CHECK: o2 (CrayPointee) size={{[0-9]+}} offset={{[0-9]+}}: ObjectEntity type: REAL({{[0-9]+}}) | ||
!CHECK: ptr (CrayPointer) size={{[0-9]+}} offset={{[0-9]+}}: ObjectEntity type: INTEGER({{[0-9]+}}) | ||
subroutine reset | ||
real::o2 | ||
pointer (ptr, o2) | ||
ptr=loc(i2) | ||
print *, "reset : o= ", o, " o2 = ", o2 | ||
o2 = 666.0 | ||
end subroutine reset | ||
end module m2 | ||
|
||
!CHECK: MainProgram scope: main | ||
!CHECK: i: Use from i in m2 | ||
!CHECK: i2: Use from i2 in m2 | ||
!CHECK: init (Subroutine): Use from init in m2 | ||
!CHECK: o (CrayPointee): Use from o in m2 | ||
!CHECK: ptr (CrayPointer): Use from ptr in m2 | ||
!CHECK: reset (Subroutine): Use from reset in m2 | ||
program main | ||
use m2 | ||
implicit none | ||
call init | ||
call reset | ||
write(6,*) "main : o = ", o | ||
if (o == 42.0) then | ||
print *, "pass" | ||
else | ||
print *, "fail" | ||
end if | ||
end program main |
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.
Uh oh!
There was an error while loading. Please reload this page.