Description
Consider the following code
character(3) :: arr(5)
arr = [character(3):: 'aa.', 'bb.', 'cc.', 'dd.', 'ee.']
print*, [integer:: (mod(iachar(arr(i:i-1:-1)(1:1)),5)+1, i=2,5,3)]
print*, [character(3):: arr(5:2:-1)]
! arr([4,3,2,1]) = & !! Same vector script as the line below.
arr([integer:: (mod(iachar(arr(i:i-1:-1)(1:1)),5)+1, i=2,5,3)]) = & !! Unexpected rror
[character(3):: arr(5:2:-1)]
print *, '10:', arr
end
Flang currently issues a compile time error as
./t.f:6:3: error: Dimension 1 of left-hand side has extent 2, but right-hand side has extent 4
arr([integer:: (mod(iachar(arr(i:i-1:-1)(1:1)),5)+1, i=2,5,3)]) = &
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The vector subscript is [4,3,2,1] as indicated in the print statement. The error is in incorrect.
All ifort, gfortran and XLF compile and run the code successfully.