[all-commits] [llvm/llvm-project] 39be2d: [flang][OpenMP][Semantics] Don't allow reduction o...

Tom Eccles via All-commits all-commits at lists.llvm.org
Thu Feb 6 02:44:39 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 39be2d0266f1aa229a79c47d81b004c8c2079362
      https://github.com/llvm/llvm-project/commit/39be2d0266f1aa229a79c47d81b004c8c2079362
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2025-02-06 (Thu, 06 Feb 2025)

  Changed paths:
    M flang/lib/Semantics/check-omp-structure.cpp
    A flang/test/Semantics/OpenMP/reduction-derived-component.f90

  Log Message:
  -----------
  [flang][OpenMP][Semantics] Don't allow reduction of derived type components (#125480)

Before this patch, reduction of derived type components crashed the
compiler when trying to create the omp.declare_reduction.

In OpenMP 3.1 the standard says "a list item that appears in a reduction
clause must be a named variable of intrinsic type" (page 106). As I
understand it, a derived type component is not a variable.

OpenMP 4.0 added declare reduction, partly so that users could define
their own reductions on derived types. The above wording was removed
from the standard but derived type components were never explicitly
allowed.

OpenMP 5.0 added "A variable that is part of another variable, with the
exception of array elements, cannot appear in17 a reduction clause".

All standard versions also require the reduction argument to be
"definable", which roughly means that it is a variable. A
derived type component is more like an expression.

Fixes #125445



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