-
Notifications
You must be signed in to change notification settings - Fork 48
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
Check for constrains C741 through C749 #1100
Open
psteinfeld
wants to merge
3
commits into
master
Choose a base branch
from
ps-types
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
! RUN: %B/test/Semantics/test_errors.sh %s %flang %t | ||
! C746, C747, and C748 | ||
module m | ||
use ISO_FORTRAN_ENV | ||
use ISO_C_BINDING | ||
|
||
! C746 If a coarray-spec appears, it shall be a deferred-coshape-spec-list and | ||
! the component shall have the ALLOCATABLE attribute. | ||
|
||
type testCoArrayType | ||
real, allocatable, codimension[:] :: allocatableField | ||
!ERROR: Component 'deferredfield' is a coarray and must have the ALLOCATABLE attribute | ||
real, codimension[:] :: deferredField | ||
!ERROR: 'pointerfield' may not have the POINTER attribute because it is a coarray | ||
!ERROR: Component 'pointerfield' is a coarray and must have the ALLOCATABLE attribute | ||
real, pointer, codimension[:] :: pointerField | ||
!ERROR: Component 'realfield' is a coarray and must have the ALLOCATABLE attribute and have a deferred coshape | ||
real, codimension[*] :: realField | ||
!ERROR: 'realfield2' is an ALLOCATABLE coarray must have a deferred coshape | ||
real, allocatable, codimension[*] :: realField2 | ||
end type testCoArrayType | ||
|
||
! C747 If a coarray-spec appears, the component shall not be of type C_PTR or | ||
! C_FUNPTR from the intrinsic module ISO_C_BINDING (18.2), or of type | ||
! TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV (16.10.2). | ||
|
||
type goodCoarrayType | ||
real, allocatable, codimension[:] :: field | ||
end type goodCoarrayType | ||
|
||
type goodTeam_typeCoarrayType | ||
type(team_type), allocatable :: field | ||
end type goodTeam_typeCoarrayType | ||
|
||
type goodC_ptrCoarrayType | ||
type(c_ptr), allocatable :: field | ||
end type goodC_ptrCoarrayType | ||
|
||
type goodC_funptrCoarrayType | ||
type(c_funptr), allocatable :: field | ||
end type goodC_funptrCoarrayType | ||
|
||
type team_typeCoarrayType | ||
!ERROR: A coarray component may not be of type TEAM_TYPE from ISO_FORTRAN_ENV | ||
type(team_type), allocatable, codimension[:] :: field | ||
end type team_typeCoarrayType | ||
|
||
type c_ptrCoarrayType | ||
!ERROR: A coarray component may not be of type C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray | ||
type(c_ptr), allocatable, codimension[:] :: field | ||
end type c_ptrCoarrayType | ||
|
||
type c_funptrCoarrayType | ||
!ERROR: A coarray component may not be of type C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray | ||
type(c_funptr), allocatable, codimension[:] :: field | ||
end type c_funptrCoarrayType | ||
|
||
! C748 A data component whose type has a coarray ultimate component shall be a | ||
! nonpointer nonallocatable scalar and shall not be a coarray. | ||
|
||
type coarrayType | ||
real, allocatable, codimension[:] :: goodCoarrayField | ||
end type coarrayType | ||
|
||
type testType | ||
type(coarrayType) :: goodField | ||
!ERROR: A component with a POINTER or ALLOCATABLE attribute may not be of a type with a coarray ultimate component (named '%goodcoarrayfield') | ||
type(coarrayType), pointer :: pointerField | ||
!ERROR: A component with a POINTER or ALLOCATABLE attribute may not be of a type with a coarray ultimate component (named '%goodcoarrayfield') | ||
type(coarrayType), allocatable :: allocatableField | ||
!ERROR: An array or coarray component may not be of a type with a coarray ultimate component (named '%goodcoarrayfield') | ||
type(coarrayType), dimension(3) :: arrayField | ||
end type testType | ||
|
||
end module m |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the test for C736 now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C736 is specific to the definition of a component of a derived type, and all of the tests in allocate11.f90 were allocate statements. I added the test resolve86.f90 in my previous pull request to cover the case of defining a component that contains a coarray ultimate component without having a parent type that contains a coarray ultimate component. This may have happened after you reviewed and approved that pull request.