Issue 132647
Summary [Flang][OpenMP] Compilation error of combining select type construct and task construct with depend clause
Labels flang:openmp
Assignees
Reporter ohno-fj
    ```
Version of flang : 21.0.0(3e6f618e86f5fbad2c2d5802416ec3d3366a2837)/AArch64
```

Combining `select type construct` and `task construct` with `depend clause` results in a compilation error.  
Compilation ends normally in the following cases:
- Do not specify the compilation option (`-fopenmp`)
- Remove `depend clause`

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

sngg362t_2.f90:
```fortran
program main
 type ty
     character(len=5)::i(3)
  end type ty

 type,extends(ty)::tt
     integer(kind=2),allocatable::n(:)
  end type tt
 class(ty),allocatable::obj

  allocate(tt::obj)
  obj%i = "AAAAA"

 select type (obj)
  type is (tt)
     allocate(obj%n(4))
     obj%n = 10
 associate(p2=>obj%n(1:4:2))
!$omp task depend(in:p2)
 obj%n(1:4:2) = 11
!$omp end task
       print *,'pass'
     endassociate
 class default
     print*,"912"
  end select
end program main
```

```
$ flang -fopenmp sngg362t_2.f90
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/FFE_2022_PH19703_08/sngg362t_2.f90":19:7): 'omp.task' op operand #0 must be variadic of OpenMP-compatible variable type, but got '!fir.box<!fir.array<2xi16>>'
error: verification of lowering to FIR failed
$
```

```
$ export OMP_NUM_THREADS=2; flang sngg362t_2.f90; ./a.out
 pass
$
```

```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp sngg362t_2.f90; ./a.out
 pass
$
```

```
$ export OMP_NUM_THREADS=2; ifx -qopenmp sngg362t_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