Issue 133669
Summary [Flang] Compilation error when an array declared as unlimited polymorphic is used in where construct
Labels flang
Assignees
Reporter 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:
```fortran
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
$
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to