Issue 123766
Summary [Flang] Static initialization failure for CHARACTER type when `constant-expr` is impl-do
Labels flang:frontend
Assignees
Reporter DanielCChen
    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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to