Skip to content

[Flang] Compilation error when an array declared as unlimited polymorphic is used in where construct #133669

@ohno-fj

Description

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

When arrays declared as unlimited polymorphic are used in where construct, a compilation error occurs.
When where construct is removed, the compilation succeeds.

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

sngg322r_2.f90:

module m1
  type x
  end type x
  logical,parameter::t=.true.,f=.false.
  logical::mask(3)=[t,f,t]
end module m1

subroutine s1
  use m1
  class(*),allocatable::v(:),u(:)
  allocate(x::v(3))
  allocate(x::u(3))
  where(mask)
     u=v
  end where
end subroutine s1

program main
  call s1
  print *,'pass'
end program main
$ flang sngg322r_2.f90
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/FFE_2022_PH19703_23/sngg322r_2.f90":14:6): 'fir.store' op operand #1 must be any reference, but got '!fir.class<none>'
error: Lowering to LLVM IR failed
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/FFE_2022_PH19703_23/sngg322r_2.f90":1:1): LLVM Translation failed for operation: fir.global
error: failed to create the LLVM module
$
$ gfortran sngg322r_2.f90; ./a.out
 pass
$
$ ifx sngg322r_2.f90; ./a.out
 pass
$

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions