Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Create symbols for args of separate-module-subprogram
A separate-module-subprogram is declared as `module procedure ...` and gets its characteristics from the declaration of that name as a separate module procedure. When we encounter one, we need to create symbols in the new subprogram scope for the dummy arguments and function return (if any). The failure to create these symbols led to the bug in issue flang-compiler/f18#1054: when a dummy argument was referenced, the compiler interpreted it as an implicit declaration because there was no symbol for the argument. Fixes flang-compiler/f18#1054. Original-commit: flang-compiler/f18@4d3c4ba Reviewed-on: flang-compiler/f18#1080 Tree-same-pre-rewrite: false
- Loading branch information
Showing
4 changed files
with
62 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
! RUN: %S/test_errors.sh %s %flang %t | ||
|
||
! 15.6.2.5(3) | ||
|
||
module m1 | ||
implicit logical(a-b) | ||
interface | ||
module subroutine sub1(a, b) | ||
real, intent(in) :: a | ||
real, intent(out) :: b | ||
end | ||
logical module function f() | ||
end | ||
end interface | ||
end | ||
submodule(m1) sm1 | ||
contains | ||
module procedure sub1 | ||
!ERROR: Left-hand side of assignment is not modifiable | ||
a = 1.0 | ||
b = 2.0 | ||
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types REAL(4) and LOGICAL(4) | ||
b = .false. | ||
end | ||
module procedure f | ||
f = .true. | ||
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types LOGICAL(4) and REAL(4) | ||
f = 1.0 | ||
end | ||
end |