[all-commits] [llvm/llvm-project] 5f7148: [flang][OpenMP] Fix USE-associated declare reducti...

Matt via All-commits all-commits at lists.llvm.org
Fri May 29 09:22:58 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5f71480b522edbe5c8c4d509e1d9872575ace1d6
      https://github.com/llvm/llvm-project/commit/5f71480b522edbe5c8c4d509e1d9872575ace1d6
  Author: Matt <MattPD at users.noreply.github.com>
  Date:   2026-05-29 (Fri, 29 May 2026)

  Changed paths:
    M flang/lib/Semantics/check-omp-structure.cpp
    A flang/test/Semantics/OpenMP/declare-reduction-use-assoc-named.f90

  Log Message:
  -----------
  [flang][OpenMP] Fix USE-associated declare reduction symbol resolution (#200328)

When a declare reduction is accessed via USE association, the symbol in
the consuming scope has `UseDetails` rather than `UserReductionDetails`.
Calling `detailsIf<UserReductionDetails>()` directly on such a symbol
returns nullptr. This causes two distinct failure modes:

1. **Operator/identifier validation** (`CheckReductionOperator`): named
   reductions and defined operators are rejected with "Invalid reduction
   identifier" or "Invalid reduction operator".

2. **Type validation** (`CheckSymbolSupportsType`,
`IsReductionAllowedForType`):
the type compatibility check cannot find `UserReductionDetails` for the
   reduction, producing "The type of 'x' is incompatible with the
   reduction operator".

This bug has existed since `UserReductionDetails` was introduced (June
2025). Only intrinsic operator reductions (like `+`) worked via USE,
because they bypass the operator validation check and their type
checking
was handled by a global module scan workaround (added Feb 2026).

**Fix:** Add `GetUltimate()` at 4 locations in `check-omp-structure.cpp`
to resolve
through `UseDetails` chains before checking for `UserReductionDetails`:
two in `CheckReductionOperator` (validation paths 1 and 2 above), one in
`CheckSymbolSupportsType`, and one in `IsReductionAllowedForType`.

Fixes https://github.com/llvm/llvm-project/issues/184932

Co-authored-by: Matt P. Dziubinski <matt-p.dziubinski at hpe.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list