[flang-commits] [flang] [flang][OpenMP] Add -fopenmp-version flag to several tests (PR #224934)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Sun Sep 20 07:22:58 PDT 2026
https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/224934
The default OpenMP version in flang is 3.1. A number of tests use features added in later versions. They currently pass because the version validity is not enforced in many cases. Set the OpenMP version explicitly to avoid failures when the checks become more strict.
>From dc1522bfd546d2f790bc134d609bcb0508a60e2b Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Sun, 20 Sep 2026 08:50:48 -0500
Subject: [PATCH] [flang][OpenMP] Add -fopenmp-version flag to several tests
The default OpenMP version in flang is 3.1. A number of tests use features
added in later versions. They currently pass because the version validity
is not enforced in many cases. Set the OpenMP version explicitly to avoid
failures when the checks become more strict.
---
flang/test/Semantics/OpenMP/allocate02.f90 | 2 +-
flang/test/Semantics/OpenMP/allocate03.f90 | 2 +-
flang/test/Semantics/OpenMP/allocate04.f90 | 2 +-
flang/test/Semantics/OpenMP/allocate05.f90 | 2 +-
flang/test/Semantics/OpenMP/allocate06.f90 | 2 +-
flang/test/Semantics/OpenMP/allocate07.f90 | 2 +-
flang/test/Semantics/OpenMP/allocate09.f90 | 2 +-
flang/test/Semantics/OpenMP/allocators01.f90 | 2 +-
flang/test/Semantics/OpenMP/allocators05.f90 | 2 +-
flang/test/Semantics/OpenMP/declare-reduction-ambiguous.f90 | 2 +-
flang/test/Semantics/OpenMP/do-concurrent-collapse.f90 | 2 +-
flang/test/Semantics/OpenMP/masked.f90 | 2 +-
flang/test/Semantics/OpenMP/requires01.f90 | 2 +-
flang/test/Semantics/OpenMP/requires02.f90 | 2 +-
flang/test/Semantics/OpenMP/requires03.f90 | 2 +-
flang/test/Semantics/OpenMP/requires06.f90 | 2 +-
flang/test/Semantics/OpenMP/requires07.f90 | 2 +-
flang/test/Semantics/OpenMP/requires08.f90 | 2 +-
flang/test/Semantics/OpenMP/requires09.f90 | 2 +-
19 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/flang/test/Semantics/OpenMP/allocate02.f90 b/flang/test/Semantics/OpenMP/allocate02.f90
index 2097d9ffb160d..6fc3532fb8f51 100644
--- a/flang/test/Semantics/OpenMP/allocate02.f90
+++ b/flang/test/Semantics/OpenMP/allocate02.f90
@@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
-! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! At most one allocator clause can appear on the allocate directive.
diff --git a/flang/test/Semantics/OpenMP/allocate03.f90 b/flang/test/Semantics/OpenMP/allocate03.f90
index f2d48b5e7cbbe..84d3506cb0d80 100644
--- a/flang/test/Semantics/OpenMP/allocate03.f90
+++ b/flang/test/Semantics/OpenMP/allocate03.f90
@@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
-! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! A variable that is part of another variable (as an array or
diff --git a/flang/test/Semantics/OpenMP/allocate04.f90 b/flang/test/Semantics/OpenMP/allocate04.f90
index ff83646f1e82f..be1f6d3beea6f 100644
--- a/flang/test/Semantics/OpenMP/allocate04.f90
+++ b/flang/test/Semantics/OpenMP/allocate04.f90
@@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
-! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! Only the allocator clause is allowed on the allocate directive
diff --git a/flang/test/Semantics/OpenMP/allocate05.f90 b/flang/test/Semantics/OpenMP/allocate05.f90
index b5f7864a42b92..2376ca72ca911 100644
--- a/flang/test/Semantics/OpenMP/allocate05.f90
+++ b/flang/test/Semantics/OpenMP/allocate05.f90
@@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
-! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! allocate directives that appear in a target region must specify an allocator
diff --git a/flang/test/Semantics/OpenMP/allocate06.f90 b/flang/test/Semantics/OpenMP/allocate06.f90
index 7b5984aa68811..b812f149de12d 100644
--- a/flang/test/Semantics/OpenMP/allocate06.f90
+++ b/flang/test/Semantics/OpenMP/allocate06.f90
@@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
-! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! List items specified in the allocate directive must not have the ALLOCATABLE attribute unless the directive is associated with an
diff --git a/flang/test/Semantics/OpenMP/allocate07.f90 b/flang/test/Semantics/OpenMP/allocate07.f90
index 3509519cae986..37cbf5540a192 100644
--- a/flang/test/Semantics/OpenMP/allocate07.f90
+++ b/flang/test/Semantics/OpenMP/allocate07.f90
@@ -1,4 +1,4 @@
-! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! A type parameter inquiry cannot appear in an allocate directive.
diff --git a/flang/test/Semantics/OpenMP/allocate09.f90 b/flang/test/Semantics/OpenMP/allocate09.f90
index 8b8d07ccd0be8..f5cbe0a589697 100644
--- a/flang/test/Semantics/OpenMP/allocate09.f90
+++ b/flang/test/Semantics/OpenMP/allocate09.f90
@@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
-! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! List items specified in an allocate directive that is associated
diff --git a/flang/test/Semantics/OpenMP/allocators01.f90 b/flang/test/Semantics/OpenMP/allocators01.f90
index a3342063e25f2..63a7956b7df60 100644
--- a/flang/test/Semantics/OpenMP/allocators01.f90
+++ b/flang/test/Semantics/OpenMP/allocators01.f90
@@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
-! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=52
! OpenMP Version 5.2
! 6.7 allocators construct
! A list item that appears in an allocate clause must appear as
diff --git a/flang/test/Semantics/OpenMP/allocators05.f90 b/flang/test/Semantics/OpenMP/allocators05.f90
index f49182f128e74..df5119a84be56 100644
--- a/flang/test/Semantics/OpenMP/allocators05.f90
+++ b/flang/test/Semantics/OpenMP/allocators05.f90
@@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
-! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=52
! OpenMP Version 5.2
! Inherited from 2.11.3 allocate directive
! allocate directives that appear in a target region must specify an
diff --git a/flang/test/Semantics/OpenMP/declare-reduction-ambiguous.f90 b/flang/test/Semantics/OpenMP/declare-reduction-ambiguous.f90
index 18ed96086ea2e..366e97f29b5d3 100644
--- a/flang/test/Semantics/OpenMP/declare-reduction-ambiguous.f90
+++ b/flang/test/Semantics/OpenMP/declare-reduction-ambiguous.f90
@@ -1,4 +1,4 @@
-! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
+! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=60
! A reduction identifier that resolves to more than one distinct user-defined
! reduction for the list item's type is ambiguous: the reduction to apply would
diff --git a/flang/test/Semantics/OpenMP/do-concurrent-collapse.f90 b/flang/test/Semantics/OpenMP/do-concurrent-collapse.f90
index 0a6906b0e2e63..1529e79e531c7 100644
--- a/flang/test/Semantics/OpenMP/do-concurrent-collapse.f90
+++ b/flang/test/Semantics/OpenMP/do-concurrent-collapse.f90
@@ -1,4 +1,4 @@
-!RUN: %python %S/../test_errors.py %s %flang -fopenmp
+!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50
integer :: i, j
! ERROR: This construct requires a nest of depth 2, but the associated nest is a nest of depth 1
diff --git a/flang/test/Semantics/OpenMP/masked.f90 b/flang/test/Semantics/OpenMP/masked.f90
index 6d610801667b5..53c5347872889 100644
--- a/flang/test/Semantics/OpenMP/masked.f90
+++ b/flang/test/Semantics/OpenMP/masked.f90
@@ -1,4 +1,4 @@
-! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
+! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=51
subroutine test_masked()
integer :: c = 1
diff --git a/flang/test/Semantics/OpenMP/requires01.f90 b/flang/test/Semantics/OpenMP/requires01.f90
index 3d20f62d5da12..9153f7ddf91b7 100644
--- a/flang/test/Semantics/OpenMP/requires01.f90
+++ b/flang/test/Semantics/OpenMP/requires01.f90
@@ -1,4 +1,4 @@
-! RUN: %python %S/../test_errors.py %s %flang -fopenmp
+! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50
!WARNING: REVERSE_OFFLOAD clause is not supported and will be ignored
!$omp requires reverse_offload unified_shared_memory
diff --git a/flang/test/Semantics/OpenMP/requires02.f90 b/flang/test/Semantics/OpenMP/requires02.f90
index 974bcceb10c6f..fd9ddffe2aebd 100644
--- a/flang/test/Semantics/OpenMP/requires02.f90
+++ b/flang/test/Semantics/OpenMP/requires02.f90
@@ -1,4 +1,4 @@
-! RUN: %python %S/../test_errors.py %s %flang -fopenmp
+! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50
! OpenMP Version 5.0
! 2.4 Requires directive
! All atomic_default_mem_order clauses in 'requires' directives must come
diff --git a/flang/test/Semantics/OpenMP/requires03.f90 b/flang/test/Semantics/OpenMP/requires03.f90
index 699967d108040..7b87a20dd59f8 100644
--- a/flang/test/Semantics/OpenMP/requires03.f90
+++ b/flang/test/Semantics/OpenMP/requires03.f90
@@ -1,4 +1,4 @@
-! RUN: %python %S/../test_errors.py %s %flang -fopenmp
+! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50
! OpenMP Version 5.0
! 2.4 Requires directive
! Target-related clauses in 'requires' directives must come strictly before any
diff --git a/flang/test/Semantics/OpenMP/requires06.f90 b/flang/test/Semantics/OpenMP/requires06.f90
index c41de68fc0f6a..58d157772a07c 100644
--- a/flang/test/Semantics/OpenMP/requires06.f90
+++ b/flang/test/Semantics/OpenMP/requires06.f90
@@ -1,4 +1,4 @@
-! RUN: %python %S/../test_errors.py %s %flang -fopenmp
+! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50
! OpenMP Version 5.0
! 2.4 Requires directive
! Target-related clauses in 'requires' directives must come strictly before any
diff --git a/flang/test/Semantics/OpenMP/requires07.f90 b/flang/test/Semantics/OpenMP/requires07.f90
index a47def1518a99..c435de6a706a1 100644
--- a/flang/test/Semantics/OpenMP/requires07.f90
+++ b/flang/test/Semantics/OpenMP/requires07.f90
@@ -1,4 +1,4 @@
-! RUN: %python %S/../test_errors.py %s %flang -fopenmp
+! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50
! OpenMP Version 5.0
! 2.4 Requires directive
! Target-related clauses in 'requires' directives must come strictly before any
diff --git a/flang/test/Semantics/OpenMP/requires08.f90 b/flang/test/Semantics/OpenMP/requires08.f90
index 593e5e31c76ce..098f4b9bd248f 100644
--- a/flang/test/Semantics/OpenMP/requires08.f90
+++ b/flang/test/Semantics/OpenMP/requires08.f90
@@ -1,4 +1,4 @@
-! RUN: %python %S/../test_errors.py %s %flang -fopenmp
+! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50
! OpenMP Version 5.0
! 2.4 Requires directive
! Target-related clauses in 'requires' directives must come strictly before any
diff --git a/flang/test/Semantics/OpenMP/requires09.f90 b/flang/test/Semantics/OpenMP/requires09.f90
index ca6ad5e8b7b8a..cdda1ce89a9cf 100644
--- a/flang/test/Semantics/OpenMP/requires09.f90
+++ b/flang/test/Semantics/OpenMP/requires09.f90
@@ -1,4 +1,4 @@
-! RUN: %python %S/../test_errors.py %s %flang -fopenmp
+! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50
! OpenMP Version 5.0
! 2.4 Requires directive
! All atomic_default_mem_order clauses in 'requires' directives found within a
More information about the flang-commits
mailing list