[Flang] Static initialization failure for CHARACTER type when constant-expr
is impl-do #123766
Open
Description
Consider the following code
PROGRAM InitExpCharOP
IMPLICIT NONE
INTEGER :: I
CHARACTER(10), PARAMETER :: A(10)= '0123456789'
CHARACTER(LEN=10, KIND=1) :: C1(10)= [(REPEAT(A(I)(1:I),1) // REPEAT(A(I)(I+1:10), 1) , I=1,10)]
END
Flang currently issues an error as:
./a3.f:7:41: error: Initialization expression for 'c1' ([(repeat(a(int(int(i,kind=4),kind=8))(1_8:int(int(i,kind=4),kind=8)),1_8)//repeat(a(int(int(i,kind=4),kind=8))(int(int(i,kind=4)+1_4,kind=8):10_8),1_8),INTEGER(8)::i=1_8,10_8,1_8)]) cannot be computed as a constant value
CHARACTER(LEN=10, KIND=1) :: C1(10)= [(REPEAT(A(I)(1:I),1) // REPEAT(A(I)(I+1:10), 1) , I=1,10)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The code seems conforming to me.
All ifort, gfortran and XLF compiled it successfully.