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

    <tr>
        <th>Summary</th>
        <td>
            [Flang][OpenMP] Compilation error when type-list in declare reduction construct is a derived type
        </td>
    </tr>

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

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

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

<pre>
    ```
Version of flang-new : 19.0.0(1a498103ee5c4d101e70dc49db11938d8b87b518)/AArch64
```
When `type-list` in `declare reduction` construct is a `derived type`, a compilation-time error occurs.

The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

udr_arr_init_struct_.f90:
```fortran
subroutine s1
 type t1
     integer(8):: a,b,c,d,e
  end type t1
!$omp declare reduction (a:t1:omp_out%c=omp_out%c+omp_in%c) &
!$omp initializer(omp_priv%c=10)
  type(t1)::k1(2)
 integer::omp_get_num_threads, tn
  k1%c=0
!$omp parallel
!$omp master
  tn = omp_get_num_threads()
!$omp end master
!$omp end parallel
!$omp parallel reduction(a:k1)
  k1%c=k1%c+1
!$omp end parallel
  if (all(k1%c==11*tn)) then
     print *, 'ok'
  else
 print *, 'ng'
     print *, k1%c
  endif
end subroutine s1

program main
  call s1
end program main
```

```
$ flang-new -fopenmp udr_arr_init_struct_.f90
error: Could not parse udr_arr_init_struct_.f90
./udr_arr_init_struct_.f90:5:28: error: expected 'TYPE'
  !$omp declare reduction (a:t1:omp_out%c=omp_out%c+omp_in%c) &
 ^
./udr_arr_init_struct_.f90:5:28: in the context: declaration type spec
  !$omp declare reduction (a:t1:omp_out%c=omp_out%c+omp_in%c) &
 ^
./udr_arr_init_struct_.f90:5:1: in the context: specification construct
  !$omp declare reduction (a:t1:omp_out%c=omp_out%c+omp_in%c) &
  ^
./udr_arr_init_struct_.f90:5:1: in the context: declaration construct
  !$omp declare reduction (a:t1:omp_out%c=omp_out%c+omp_in%c) &
  ^
./udr_arr_init_struct_.f90:2:3: in the context: specification part
    type t1
    ^
./udr_arr_init_struct_.f90:1:1: in the context: SUBROUTINE subprogram
  subroutine s1
 ^
$
```

```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp udr_arr_init_struct_.f90; ./a.out
 ok
$
```

```
$ export OMP_NUM_THREADS=2; ifort -qopenmp -diag-disable=10448 udr_arr_init_struct_.f90; ./a.out
 ok
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVl1v2zYU_TXXL4QN8UqypQc_yHa87aEfaNMNezIo8dpmQ5MaSbXpfv1AyXYcJ1k7oB0aBLJIkeeee0heHuG92hmiOeQLyFcj0YW9dXO7N3a8_Tiqrfwyh2ly_E9WkFS_k_PKGma3bKuF2Y0NfWaQVoyXk2SSABZcZGXBk5QobzLJE06zRDZZKWvOy7SQRV3M6pwXgCXguqpcs59mA_hVrD_2ZBhMk_ClpbFWPsA0YarvktRo4Yg5kl0TlDXxU2OND65rAlOeiWGYU59IsogQYXHJBGvsoVVaxFnjoA7EyDnrmG2azvnJkUn_vN0T21qt7WdldizGC3tigXxgrbM7Jw4RcX3SITZ-2VoXnDBMGMlUbFzGA1zTPTVdfGeOfKfDo4CddBvh3EYZFTZDLpvJtkwgra4UOoYZen1XO9sFZYh5PnT1KbNwasU_ZQLtyAEWvfZpFZdNAC5rwGUDuJSASzpNICMfYwBywMweWvZEfAZYCEirwCGt7KHd2C4A5g2kq8sWLmJLmaFRMsDpNXRMXAmt_u55xuGtU5-OWDyJvI_8-iXFIvBzLnccsMCHIad8-48RakdhY7rDJuwdCenjcgVzwouz-yjJNadWOKE16ev-g_CB3JmPYZCu2LNxijOph9lR30uEx19einnqv9j4g_R3_EKbcy7HF1w8WcOnQRhT234htQYszhBRdw5YBdMf2DIeAXOxq1qnTGCAVZQTcGbvAGfnTaT9aUNdjzO7i3HXOMfoD1tRbYdGpP3Mbh-exzPJ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