Issue 124618
Summary [Flang] Incorrect diagnostic on KIND= when the expr is compile time constant.
Labels flang:frontend
Assignees
Reporter DanielCChen
    Consider the following code:
```

  INTEGER(1), ALLOCATABLE :: I1

  CHARACTER :: CC(0:127)

  TYPE :: DT
    INTEGER(1) :: K1=0
    INTEGER(1) :: K8=0
 END TYPE

  TYPE (DT), PARAMETER :: T=DT(1,8)

  CC =(/(ACHAR(I=I, KIND=1), I=0, 127)/)

  ALLOCATE(I1)
  IF (ANY(IACHAR(CC(0:0), KIND=IACHAR(ACHAR(1, KIND=SIZE((/T%K1/))), KIND=T%K8))  .NE. 0 )) error STOP 11
  end
```

Flang currently issues an error as:
```
error: Semantic errors in t.f
./t.f:17:39: error: 'kind=' argument must be a constant scalar integer whose value is a supported kind for the intrinsic result type
    IF (ANY(IACHAR(CC(0:0), KIND=IACHAR(ACHAR(1, KIND=SIZE((/T%K1/))), KIND=T%K8)) .NE. 0 )) error STOP 11
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

The code seems conforming to me. All ifort, gfortran and XLF compile and run it successfully.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to