mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 04:06:46 +00:00

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
21 lines
687 B
Fortran
21 lines
687 B
Fortran
! 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
|
|
|