llvm-project/flang/test/Semantics/definable06.f90
Peter Klausler 22ed61ed87
[flang] Emit errors on vector subscripts with duplicated elements when 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
2023-07-17 12:20:16 -07:00

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