Issue 176279
Summary [Flang][OpenMP] Compilation error when type-list in declare reduction directive is a derived type accessed by use association
Labels flang:openmp
Assignees
Reporter ohno-fj
    ```
Version of flang : 22.0.0(2f7e218017db69454ea84e1849fcb9a11b1f7fef)/AArch64
```

In the attached program (`masa_udr0009_5.f90`), specifying `derived type name` in `type-list` of `declare reduction directive` by `use association` causes an error during compilation.
After checking `OpenMP 6.0 : 7.6.14 declare_reduction Directive`, the program appears to contain no particular errors.

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

masa_udr0009_5.f90:
```fortran
module mod
  type t
     integer::i=0
  end type t
!$omp declare reduction (+:t:omp_out%i=omp_out%i+omp_in%i) &
!$omp initializer(omp_priv%i=0)
end module mod

program main
  use mod
 integer::i
  type(t)::x1
  x1%i=0
!$omp parallel do reduction(+:x1)
  do i=1,10
     x1%i=x1%i+1
  end do
!$omp end parallel do
  print *,'pass'
end program main
```

```
$ flang -fopenmp masa_udr0009_5.f90
error: Semantic errors in masa_udr0009_5.f90
./masa_udr0009_5.f90:14:31: error: The type of 'x1' is incompatible with the reduction operator.
  !$omp parallel do reduction(+:x1)
                                ^^
$
```

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

```
$ export OMP_NUM_THREADS=2; ifx -qopenmp masa_udr0009_5.f90; ./a.out
 pass
$
```


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to