https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109911
Bug ID: 109911 Summary: [OpenMP] 'declare reduction' not USE associated Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: openmp, rejects-valid Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- Found via OpenMP Spec Pull Request #3629 for Issue #3595. The following program fails with: Error: !$OMP DECLARE REDUCTION add not found at (1) But it works when moving or copying the declare line into the main program. [Side remark: It is unclear (see PR above) whether the code is supposed to work with 'private'.] Note that the spec states: "If a _directive_ appears in the specification part of a module then the behavior is as if that _directive_ appears in the specification part of any _compilation-unit_ that references the module with a *USE* statement unless otherwise specified." module m ! private !$omp declare reduction (Add : integer : myadd(omp_in, omp_out)) contains subroutine myadd(in, out) integer :: in, out end end module use m implicit none (type,external) integer :: x !$omp parallel reduction(Add: x) ! ... !$omp end parallel end