Skip to content

[Flang] Compilation error when using the type is statement in select type construct #128608

Closed
@ohno-fj

Description

@ohno-fj
Version of flang : 21.0.0(f75126eeabba13ce2aab53c2e4296fca12b9da0d)/AArch64

In the attached program, the type is statement is defined in select type construct, and the type of variable x is treated as integer instead of polyphasic in subsequent blocks.
This is mentioned in Fortran standard 2023: 11.1.11.2 Execution of the SELECT TYPE construct, so it seems correct that this should not result in a compilation error.
However, this program results in compilation error in Flang.

The following are the test program, Flang, Gfortran and ifx compilation/execution result.

sngtatm013_2.f90:

subroutine ss2
  class(*),allocatable::x(:)
  allocate(x,source=[1])
  select type(x)
  type is(integer)
     do concurrent(ii=1:10000:1,.true.)
        x(ii)=ii
     end do
  end select
end subroutine ss2
$ flang -c sngtatm013_2.f90
error: Semantic errors in sngtatm013_2.f90
./sngtatm013_2.f90:7:9: error: Deallocation of a polymorphic entity caused by assignment not allowed in DO CONCURRENT
          x(ii)=ii
          ^^^^^
./sngtatm013_2.f90:2:25: Declaration of 'x'
    class(*),allocatable::x(:)
                          ^
$ 
$ gfortran -c sngtatm013_2.f90
$ 
$ ifx -c sngtatm013_2.f90
$ 

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions