-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[flang][semantics] add semantic check that STAT and ERRMSG are not (de)allocated by same statement #164529
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
[flang][semantics] add semantic check that STAT and ERRMSG are not (de)allocated by same statement #164529
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f86d026
initial commit
akuhlens be2135b
address feedback
akuhlens 12b2fa2
handle base that is allocation
akuhlens d0f21ea
explicitly null init pathSym and rootSym
akuhlens 5569917
fixing random edit
akuhlens bd89b72
simplify
akuhlens 2b557ad
remove random included file
akuhlens 4bf8199
IsSameAllocation/AreSameAllocation
akuhlens 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| ! RUN: %python %S/test_errors.py %s %flang_fc1 | ||
| ! Check for semantic errors in ALLOCATE statements | ||
|
|
||
| program allocate14 | ||
|
|
||
| integer, allocatable :: i1, i2 | ||
| character(200), allocatable :: msg1, msg2 | ||
| type t | ||
| integer, allocatable :: i | ||
| character(10), allocatable :: msg | ||
| end type t | ||
| type(t) :: tt(2) | ||
| type(t), allocatable :: ts(:) | ||
|
|
||
| allocate(i1) | ||
| allocate(msg1) | ||
|
|
||
| allocate(i2, stat=i1, errmsg=msg1) | ||
| allocate(msg2, stat=i1, errmsg=msg1) | ||
| deallocate(i2, stat=i1, errmsg=msg1) | ||
| deallocate(msg2, stat=i1, errmsg=msg1) | ||
|
|
||
| !ERROR: STAT variable in ALLOCATE must not be the variable being allocated | ||
| allocate(i2, stat=i2, errmsg=msg2) | ||
| !ERROR: ERRMSG variable in ALLOCATE must not be the variable being allocated | ||
| allocate(msg2, stat=i2, errmsg=msg2) | ||
| !ERROR: STAT variable in DEALLOCATE must not be the variable being deallocated | ||
| deallocate(i2, stat=i2, errmsg=msg2) | ||
| !ERROR: ERRMSG variable in DEALLOCATE must not be the variable being deallocated | ||
| deallocate(msg2, stat=i2, errmsg=msg2) | ||
|
|
||
| allocate(tt(1)%i) | ||
| allocate(tt(1)%msg) | ||
|
|
||
| allocate(tt(2)%i, stat=tt(1)%i, errmsg=tt(1)%msg) | ||
| allocate(tt(2)%msg, stat=tt(1)%i, errmsg=tt(1)%msg) | ||
| deallocate(tt(2)%i, stat=tt(1)%i, errmsg=tt(1)%msg) | ||
| deallocate(tt(2)%msg, stat=tt(1)%i, errmsg=tt(1)%msg) | ||
|
|
||
| !ERROR: STAT variable in ALLOCATE must not be the variable being allocated | ||
| allocate(tt(2)%i, stat=tt(2)%i, errmsg=tt(2)%msg) | ||
| !ERROR: ERRMSG variable in ALLOCATE must not be the variable being allocated | ||
| allocate(tt(2)%msg, stat=tt(2)%i, errmsg=tt(2)%msg) | ||
| !ERROR: STAT variable in DEALLOCATE must not be the variable being deallocated | ||
| deallocate(tt(2)%i, stat=tt(2)%i, errmsg=tt(2)%msg) | ||
| !ERROR: ERRMSG variable in DEALLOCATE must not be the variable being deallocated | ||
| deallocate(tt(2)%msg, stat=tt(2)%i, errmsg=tt(2)%msg) | ||
|
|
||
| !TODO: STAT variable in ALLOCATE must not be the variable being allocated | ||
| !TODO: ERRMSG variable in ALLOCATE must not be the variable being allocated | ||
| allocate(ts(10), stat=ts(1)%i, errmsg=ts(1)%msg) | ||
| !TODO: STAT variable in DEALLOCATE must not be the variable being deallocated | ||
| !TODO: ERRMSG variable in DEALLOCATE must not be the variable being deallocated | ||
| deallocate(ts, stat=ts(1)%i, errmsg=ts(1)%msg) | ||
| end program | ||
|
|
||
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.