Issue 161961
Summary [flang] Error when using constant _expression_ as KIND= _expression_
Labels flang:frontend
Assignees
Reporter DanielCChen
    Consider the following code
```
  type base(k1,k2)
      integer(1),kind :: k1
 integer(k1),kind :: k2
 integer(kind(int(k1,1)+int(k2,k1))),allocatable :: i(:) !! FAIL
 !integer(kind(int(k1,1)+int(k2,2))),allocatable :: i(:) !! WORK
   end type
   type(base(2,2)) :: b1
   print*, kind(b1%i)
   end
```

Flang complains:
```
./t.f:4:30: error: 'kind=' argument must be a constant scalar integer whose value is a supported kind for the intrinsic result type
        integer(kind(int(k1,1)+int(k2,k1))),allocatable :: i(:) !! FAIL

```

If I replace `k1` with `2`, which is the same value when the type is instantiated, it works.

This is a similar issue to issue #161694 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to