Issue |
130534
|
Summary |
[Flang] Compile error when scalar-int-constant-expr _expression_ specified for KIND= of intrinsic-type-spec in data-component-def-stmt of derived type
|
Labels |
flang:frontend
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang : 21.0.0(8c7c791284877e36f73c41ffa56b52c13e613993)/AArch64
```
In `data-component-def-stmt` of `derived type`, `scalar-int-constant-expr _expression_ (k3/k1)` specified for `KIND=` of `intrinsic-type-spec` results in a compilation error.
According to the `Fortran Standard 2023: 7.5.4.1 Component definition statement`, only `scalar-int-constant-expr` can be specified in `KIND=`, so there should be no problem with the attached program.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
FT_PDT_utf32_04_2.f90:
```fortran
program main
type ty(k1,k2,k3)
Integer,kind :: k1,k2,k3
character(kind= k2**1,len = k1+k2+k3) :: ch0(k2*k1,k3)!ok
character(kind= k1*k1,len = k1+k2+k3) :: ch1(k2*k1,k3)!ok
character(kind= k3/k1,len = k1+k2+k3) :: ch2(k2*k1,k3)!ok
end type ty
type(ty(2,4,8)):: obj
print*,'PASS'
end program main
```
```
$ flang FT_PDT_utf32_04_2.f90
error: Semantic errors in FT_PDT_utf32_04_2.f90
./FT_PDT_utf32_04_2.f90:6:22: error: Must be a constant value
character(kind= k3/k1,len = k1+k2+k3) :: ch2(k2*k1,k3)!ok
^^^^^
$
```
```
$ gfortran FT_PDT_utf32_04_2.f90; ./a.out
PASS
$
```
```
$ ifx FT_PDT_utf32_04_2.f90; ./a.out
PASS
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs