[flang-commits] [flang] [llvm] [flang][OpenMP] Gate the allocate clause at OpenMP 5.0 (PR #213980)

Spencer Bryngelson via flang-commits flang-commits at lists.llvm.org
Wed Aug 5 07:45:38 PDT 2026


sbryngelson wrote:

Moved back into `OMP.td` as requested, @kparzysz. The flang-only version is gone; this is again the
58-instance gate plus the flang test updates.

@ddpagan @alexey-bataev a clang question, since this changes clang and not just flang.

`allocate` is an OpenMP 5.0 clause, but 58 of the 62 directives that allow it declare it in `OMP.td`
with no minimum version, so clang accepts it at 4.5 and earlier. Gating it at 5.0 makes clang reject
those, which fails **83 `Clang :: OpenMP` tests**.

The question is whether that acceptance is deliberate. @kparzysz put it as: if clang wants to keep
`allocate` at 4.5 as an extension, the right fix is to remove the `50` from the four directives that
do have it; otherwise, add `50` everywhere and update the affected tests.

I cannot tell from the tests alone. Some look intentional, e.g.
`clang/test/OpenMP/distribute_simd_ast_print.cpp` runs at `-fopenmp-version=45` and has CHECK lines
asserting the clause round-trips. But that is equally consistent with the tests having been sprayed
across versions when the clause was added.

Scope if you want it gated, measured on a clang built from the gated table. Of the 276
`clang/test/OpenMP` tests that use `allocate(`:

| | count |
|---|---|
| no pre-5.0 RUN line, unaffected | 186 |
| both pre-5.0 and 5.0+ RUN lines, need prefixed `-verify` | 89 |
| pre-5.0 only, just add `expected-error` | 1 |

I am happy to do that conversion, but I did not want to write 89 files of test churn before knowing
which branch you want, since the two answers point in opposite directions.

No urgency: the crash that started this is already fixed by #214012, which has landed. What this PR
adds is the specific diagnostic rather than the generic decomposition error, so dropping it is a
reasonable outcome too.


https://github.com/llvm/llvm-project/pull/213980


More information about the flang-commits mailing list