[Flang] Incorrect diagnose on SELECT TYPE selector
Consider the following code:
module m
type base
integer i
end type
end module
subroutine sub(arg)
use m
class(base) :: arg(*)
select type (arg)
type is (Base)
print *, "typeis"
class default
print *, "classdefault"
end select
end
Flang currently issues an error as:
error: Semantic errors in t.f
./t.f:10:14: error: Whole assumed-size array 'arg' may not appear here without subscripts
select type (arg)
^^^
./t.f:9:16: Declaration of 'arg'
class(base) :: arg(*)
^^^
It doesn't seem correct to me. The SELECT TYPE inquires the dynamic type of the selctor. It shouldn't matter if it is a assumed-size whole array or not.
@llvm/issue-subscribers-flang-frontend
Author: Daniel Chen (DanielCChen)
subroutine sub(arg) use m class(base) :: arg(*) select type (arg) type is (Base) print *, "typeis" class default print *, "classdefault" end select end
Flang currently issues an error as:
error: Semantic errors in t.f ./t.f:10:14: error: Whole assumed-size array 'arg' may not appear here without subscripts select type (arg) ^^^ ./t.f:9:16: Declaration of 'arg' class(base) :: arg(*) ^^^
It doesn't seem correct to me. The SELECT TYPE inquires the dynamic type of the `selctor`. It shouldn't matter if it is a assumed-size whole array or not.
</details>
@llvm/issue-subscribers-bug
Author: Daniel Chen (DanielCChen)
subroutine sub(arg) use m class(base) :: arg(*) select type (arg) type is (Base) print *, "typeis" class default print *, "classdefault" end select end
Flang currently issues an error as:
error: Semantic errors in t.f ./t.f:10:14: error: Whole assumed-size array 'arg' may not appear here without subscripts select type (arg) ^^^ ./t.f:9:16: Declaration of 'arg' class(base) :: arg(*) ^^^
It doesn't seem correct to me. The SELECT TYPE inquires the dynamic type of the `selctor`. It shouldn't matter if it is a assumed-size whole array or not.
</details>
https://github.com/llvm/llvm-project/pull/82806
I have verified PR #82806 has fixed the reproducer and the origin test case. Thanks for the quick fix! @klausler