<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/132647>132647</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang][OpenMP] Compilation error of combining select type construct and task construct with depend clause
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:openmp
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ohno-fj
      </td>
    </tr>
</table>

<pre>
    ```
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
$
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0Vt1u47YSfprxDWGDGur3wheKHZ09B9izi-22vQwoibK5oUSVpBL77QtSsmOnKXrR1jAgUqOZb_74cbi18jAIsYXkAZL9ik_uqM1WHwe97n6sat2et5DS5U_LX4SxUg9Ed6RTfDgQYCXBaEM3FDBnIu3SKBd52iVdzVtssE1yinGUioa1jKUpx5xlgAVgVZamOaYx0PIWAWi5030tB-mtp9QKJRpH3HkUpNGDdWZqHKSU8KH1csft873gVbqjl7RiFENLGsUnK7zACDspZ4kcCCeN7kepuPPRCGO02RAyY7-9HlpLBm16rtTZa7mjIJ1WSr965xpuhQXmPV6TvSaDdsSOopHdOXx5i6DH8ADMIaXrTo9i6EcfMBZB_Zvo9Yv4yOs5Jd_vkLkRAcEJ68ho9MHwHnBHKl8Sv_hPp40zfAhJkt3p1hfASpxEMwWH5pRsZhA7HA4sRfeEm66gc2TX0iwWgZYLIOm59Nu5NO7sl_7XHLnhjRMGMFdiALZPfJSsBFZK3yRzzMSn90b3YglwJ07Opx4wd-erqnMXADk4cQjmn-XQAttj6KcdV0o33PFaiVll8Olm5R_xgqlGcfuG8YG6rn8sfpFFJvzn7k26GA7LRBJgewKIpf8B4qJ828CA-Y1eeCUtma0uL8kd2mzaBxIHL6_fLIKAGfkmIdxa3chZbURge2CPb-oRsDIGVuLVDGAEGOt-JOEIzX0HmMsBWDnigvWxhRk2urMS0svt88VDQkYjB0cAS8AdYDaGfGcXuRjaN5cv9SCt6PikrrUOJi4WsIhwzutczDmzQEu_edeV7yjlbovxQl6Xg0jedT4tg3yN_hCQV248Gfnll1EMn78SO42jNs5TwmxIWmKdVIqI0yiM7MXguCKQPKx_vX2znmkAkr132pOON6p04xsVEbB61eYZsDrqXgBWnoYBq913wMqfdcDKH0O_GwErI0aj26kR5n-AVVU9PiFFfPr6KSoyyp5oDli9iwwRWBn5I5XNJ4sAZrofN6FymBE9Ej0KE8gVG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