-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Ignore FINAL subroutines with mismatching type parameters
When a parameterized derived type has FINAL subroutines, only those FINAL subroutines whose dummy argument's type matches the type parameter values of a particular instantiation are relevant to that instantiation. Differential Revision: https://reviews.llvm.org/D145741
- Loading branch information
Showing
11 changed files
with
144 additions
and
70 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
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,28 @@ | ||
! RUN: %python %S/test_errors.py %s %flang_fc1 | ||
! PDT sensitivity of FINAL subroutines | ||
module m | ||
type :: pdt(k) | ||
integer, kind :: k | ||
contains | ||
final :: finalArr, finalElem | ||
end type | ||
contains | ||
subroutine finalArr(x) | ||
type(pdt(1)), intent(in out) :: x(:) | ||
end | ||
elemental subroutine finalElem(x) | ||
type(pdt(3)), intent(in out) :: x | ||
end | ||
end | ||
|
||
program test | ||
use m | ||
type(pdt(1)) x1(1) | ||
type(pdt(2)) x2(1) | ||
type(pdt(3)) x3(1) | ||
!ERROR: Left-hand side of assignment is not definable | ||
!BECAUSE: Variable 'x1([INTEGER(8)::1_8])' has a vector subscript and cannot be finalized by non-elemental subroutine 'finalarr' | ||
x1([1]) = pdt(1)() | ||
x2([1]) = pdt(2)() ! ok, doesn't match either | ||
x3([1]) = pdt(3)() ! ok, calls finalElem | ||
end |