Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Changes to enforce constraints C727 to C730 and most constrai…
…nts related to attributes The full list of constraints is C727, C728, C729, C730, C743, C755, C759, C778, and C1543. I added a function to tools.cpp to check to see if a symbol name is the name of an intrinsic type. The biggest change was to resolve-names.cpp to check to see if attributes were either duplicated or in conflict with each other. I changed all locations where attributes were set to check for duplicates or conflicts. I also added tests for all checks and annotated the tests and code with the numbers of the constraints being tested/checked. Original-commit: flang-compiler/f18@3f30e8a Reviewed-on: flang-compiler/f18#1084
- Loading branch information
1 parent
23c227a
commit e17e717
Showing
15 changed files
with
513 additions
and
29 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
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,32 @@ | ||
! RUN: %S/test_errors.sh %s %flang %t | ||
module m | ||
! C743 No component-attr-spec shall appear more than once in a | ||
! given component-def-stmt. | ||
! | ||
! R737 data-component-def-stmt -> | ||
! declaration-type-spec [[, component-attr-spec-list] ::] | ||
! component-decl-list | ||
! component-attr-spec values are: | ||
! PUBLIC, PRIVATE, ALLOCATABLE, CODIMENSION [*], CONTIGUOUS, DIMENSION(5), | ||
! POINTER | ||
|
||
type :: derived | ||
!WARNING: Attribute 'PUBLIC' cannot be used more than once | ||
real, public, allocatable, public :: field1 | ||
!WARNING: Attribute 'PRIVATE' cannot be used more than once | ||
real, private, allocatable, private :: field2 | ||
!ERROR: Attributes 'PUBLIC' and 'PRIVATE' conflict with each other | ||
real, public, allocatable, private :: field3 | ||
!WARNING: Attribute 'ALLOCATABLE' cannot be used more than once | ||
real, allocatable, public, allocatable :: field4 | ||
!ERROR: Attribute 'CODIMENSION' cannot be used more than once | ||
real, public, codimension[:], allocatable, codimension[:] :: field5 | ||
!WARNING: Attribute 'CONTIGUOUS' cannot be used more than once | ||
real, public, contiguous, pointer, contiguous, dimension(:) :: field6 | ||
!ERROR: Attribute 'DIMENSION' cannot be used more than once | ||
real, dimension(5), public, dimension(5) :: field7 | ||
!WARNING: Attribute 'POINTER' cannot be used more than once | ||
real, pointer, public, pointer :: field8 | ||
end type derived | ||
|
||
end module m |
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,54 @@ | ||
! RUN: %S/test_errors.sh %s %flang %t | ||
module m | ||
! C755 The same proc-component-attr-spec shall not appear more than once in a | ||
! given proc-component-def-stmt. | ||
! C759 PASS and NOPASS shall not both appear in the same | ||
! proc-component-attr-spec-list. | ||
! | ||
! R741 proc-component-def-stmt -> | ||
! PROCEDURE ( [proc-interface] ) , proc-component-attr-spec-list | ||
! :: proc-decl-list | ||
! proc-component-attr-spec values are: | ||
! PUBLIC, PRIVATE, NOPASS, PASS, POINTER | ||
|
||
type :: procComponentType | ||
!WARNING: Attribute 'PUBLIC' cannot be used more than once | ||
procedure(publicProc), public, pointer, public :: publicField | ||
!WARNING: Attribute 'PRIVATE' cannot be used more than once | ||
procedure(privateProc), private, pointer, private :: privateField | ||
!WARNING: Attribute 'NOPASS' cannot be used more than once | ||
procedure(nopassProc), nopass, pointer, nopass :: noPassField | ||
!WARNING: Attribute 'PASS' cannot be used more than once | ||
procedure(passProc), pass, pointer, pass :: passField | ||
!ERROR: Attributes 'PASS' and 'NOPASS' conflict with each other | ||
procedure(passNopassProc), pass, pointer, nopass :: passNopassField | ||
!WARNING: Attribute 'POINTER' cannot be used more than once | ||
procedure(pointerProc), pointer, public, pointer :: pointerField | ||
contains | ||
procedure :: noPassProc | ||
procedure :: passProc | ||
procedure :: passNopassProc | ||
procedure :: publicProc | ||
procedure :: privateProc | ||
end type procComponentType | ||
|
||
contains | ||
subroutine publicProc(arg) | ||
class(procComponentType) :: arg | ||
end | ||
subroutine privateProc(arg) | ||
class(procComponentType) :: arg | ||
end | ||
subroutine noPassProc(arg) | ||
class(procComponentType) :: arg | ||
end | ||
subroutine passProc(arg) | ||
class(procComponentType) :: arg | ||
end | ||
subroutine passNopassProc(arg) | ||
class(procComponentType) :: arg | ||
end | ||
subroutine pointerProc(arg) | ||
class(procComponentType) :: arg | ||
end | ||
end module m |
Oops, something went wrong.