Issue 123362
Summary [Flang] Static initialization failure when the `constant-expr` is an array of derived type.
Labels flang:frontend
Assignees
Reporter DanielCChen
    Consider the following code:

```
  PROGRAM  main
  IMPLICIT NONE

  TYPE :: DT
    CHARACTER(38) :: C = "1234567890abcdefghijklmnopqrstuvwxyz  "
 CHARACTER(16) :: C1= "543210  abc ABC "
  END TYPE

  TYPE (DT), PARAMETER :: X(4,4) = DT()
  !TYPE (DT), PARAMETER :: X = DT()      !! Works fine.

  INTEGER(KIND(VERIFY(STRING=X%C, SET=X%C1, KIND=1))) :: &
 &TI1(4,4)=VERIFY(STRING=X%C, SET=X%C1, KIND=1)
end
```

Flang currently failed to compile the above code as
```
error: Semantic errors in a4.f
./a4.f:13:16: error: Must be a constant value
 &TI1(4,4)=VERIFY(STRING=X%C, SET=X%C1, KIND=1)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

The code seems standard conforming. All ifort, gfortran and XLF compile the code successfully. If `X` is scalar instead of an array, Flang compiles it fine.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to