Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Improve checking of structure constructor arguments
When a misparsed FunctionReference was converted to a StructureConstructor, the components accessed were not checked for accessibility. The conversion happens in expression analysis so that where the accessibity must be checked. So move `CheckAccessibleComponent` to `tools.h` so that it can be shared by `resolve-names.cpp` and `expression.cpp`. Add FindModuleContaining to help implement this and use it other places. Check that an access-spec can only appear in a module. Remove some unnecessary "semantics::" qualifiers. Original-commit: flang-compiler/f18@99ce156 Reviewed-on: flang-compiler/f18#1046
- Loading branch information
Showing
7 changed files
with
157 additions
and
103 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,42 @@ | ||
module m | ||
public | ||
type t | ||
integer, private :: i | ||
end type | ||
!ERROR: The default accessibility of this module has already been declared | ||
private | ||
private !C869 | ||
end | ||
|
||
subroutine s | ||
subroutine s1 | ||
!ERROR: PUBLIC statement may only appear in the specification part of a module | ||
public | ||
public !C869 | ||
end | ||
|
||
subroutine s2 | ||
!ERROR: PRIVATE attribute may only appear in the specification part of a module | ||
integer, private :: i !C817 | ||
end | ||
|
||
subroutine s3 | ||
type t | ||
!ERROR: PUBLIC attribute may only appear in the specification part of a module | ||
integer, public :: i !C817 | ||
end type | ||
end | ||
|
||
module m4 | ||
interface | ||
module subroutine s() | ||
end subroutine | ||
end interface | ||
end | ||
submodule(m4) sm4 | ||
!ERROR: PUBLIC statement may only appear in the specification part of a module | ||
public !C869 | ||
!ERROR: PUBLIC attribute may only appear in the specification part of a module | ||
real, public :: x !C817 | ||
type :: t | ||
!ERROR: PRIVATE attribute may only appear in the specification part of a module | ||
real, private :: y !C817 | ||
end type | ||
end |
Oops, something went wrong.