[flang-commits] [flang] [Flang][OpenMP]Add tests for align and allocator in allocate clauses (PR #121356)

Mats Petersson via flang-commits flang-commits at lists.llvm.org
Mon Dec 30 12:05:34 PST 2024


https://github.com/Leporacanthicus created https://github.com/llvm/llvm-project/pull/121356

No functional change.

(Also, tried to filter out all ALLOCATOR modifiers, but that makes some other tests fail).

>From 28325abd4108deee6a48a68e1b63da04ba55367e Mon Sep 17 00:00:00 2001
From: Mats Petersson <mats.petersson at arm.com>
Date: Mon, 30 Dec 2024 18:49:55 +0000
Subject: [PATCH] [Flang][OpenMP]Add tests for align and allocator in allocate
 clauses

No functional change.

(Also, tried to filter out all ALLOCATOR modifiers, but that makes some
other tests fail).
---
 flang/lib/Parser/openmp-parsers.cpp               |  4 ++--
 .../Lower/OpenMP/Todo/allocate-clause-align.f90   | 14 ++++++++++++++
 .../OpenMP/Todo/allocate-clause-allocator.f90     | 15 +++++++++++++++
 3 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90
 create mode 100644 flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90

diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index 67385c03f66c80..dea4102205be0c 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -157,8 +157,8 @@ static TypeDeclarationStmt makeIterSpecDecl(std::list<ObjectName> &&names) {
 
 TYPE_PARSER(construct<OmpAlignment>(scalarIntExpr))
 
-TYPE_PARSER(construct<OmpAlignModifier>( //
-    "ALIGN" >> parenthesized(scalarIntExpr)))
+TYPE_PARSER(
+    construct<OmpAlignModifier>("ALIGN"_tok >> parenthesized(scalarIntExpr)))
 
 TYPE_PARSER(construct<OmpAllocatorComplexModifier>(
     "ALLOCATOR" >> parenthesized(scalarIntExpr)))
diff --git a/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 b/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90
new file mode 100644
index 00000000000000..c51ba9be84235b
--- /dev/null
+++ b/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90
@@ -0,0 +1,14 @@
+! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
+
+! CHECK: not yet implemented: OmpAllocateClause ALIGN modifier
+program p
+  use omp_lib
+  integer :: x
+  integer :: a
+  integer :: i
+  !$omp parallel private(x) allocate(align(4): x)
+  do i=1,10
+     a = a + i
+  end do
+  !$omp end parallel
+end program p
diff --git a/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 b/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90
new file mode 100644
index 00000000000000..01a91e84a0d477
--- /dev/null
+++ b/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90
@@ -0,0 +1,15 @@
+! RUN: %not_todo_cmd %flang_fc1 -emit-llvm -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
+
+! CHECK: not yet implemented: Unhandled clause allocate in omp.parallel
+! CHECK: LLVM Translation failed for operation: omp.parallel
+program p
+  use omp_lib
+  integer :: x
+  integer :: a
+  integer :: i
+  !$omp parallel private(x) allocate(allocator(omp_default_mem_alloc): x)
+  do i=1,10
+     a = a + i
+  end do
+  !$omp end parallel
+end program p



More information about the flang-commits mailing list