-
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] Emit errors on vector subscripts with duplicated elements whe…
…n object must be definable When the left-hand side of an assignment, or any other context demanding definability, comprises a designator with a vector subscript that is known at compilation time to have one or more duplicated elements, emit an error message. Differential Revision: https://reviews.llvm.org/D155492
- Loading branch information
Showing
4 changed files
with
69 additions
and
2 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,20 @@ | ||
! RUN: %python %S/test_errors.py %s %flang_fc1 | ||
module m | ||
contains | ||
elemental subroutine inout(x) | ||
integer, intent(inout) :: x | ||
end | ||
subroutine test | ||
integer :: x(2) | ||
!ERROR: Left-hand side of assignment is not definable | ||
!BECAUSE: Variable has a vector subscript with a duplicated element | ||
x([1,1]) = 0 | ||
!ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' is not definable | ||
!BECAUSE: Variable has a vector subscript with a duplicated element | ||
call inout(x([(mod(j-1,2)+1,j=1,10)])) | ||
!ERROR: Input variable 'x' is not definable | ||
!BECAUSE: Variable has a vector subscript with a duplicated element | ||
read (*,*) x([2,2]) | ||
end | ||
end | ||
|