[flang-commits] [flang] [Flang][Openmp]Prevent TODO abort on nothing directive (PR #202679)
via flang-commits
flang-commits at lists.llvm.org
Tue Jun 9 20:58:34 PDT 2026
https://github.com/ShashwathiNavada updated https://github.com/llvm/llvm-project/pull/202679
>From a5727ebee621e07eb843934057ace014ebaeacf3 Mon Sep 17 00:00:00 2001
From: ShashwathiNavada <shashwathinavada at gmail.com>
Date: Tue, 9 Jun 2026 09:43:37 -0500
Subject: [PATCH 1/2] [Flang][Openmp]Prevent TODO abort on nothing directive
---
flang/lib/Lower/OpenMP/OpenMP.cpp | 15 ++++++++++++---
flang/test/Lower/OpenMP/nothing.f90 | 8 ++++++++
2 files changed, 20 insertions(+), 3 deletions(-)
create mode 100644 flang/test/Lower/OpenMP/nothing.f90
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 266b06f353675..20be07d463a64 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -4899,9 +4899,18 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
semantics::SemanticsContext &semaCtx,
lower::pft::Evaluation &eval,
- const parser::OmpUtilityDirective &) {
- if (!semaCtx.langOptions().OpenMPSimd)
- TODO(converter.getCurrentLocation(), "OmpUtilityDirective");
+ const parser::OmpUtilityDirective &dir) {
+ common::visit(common::visitors{
+ [&](const parser::OmpNothingDirective &) {
+ // nothing-directive is a no-op (OpenMP 5.2 [8.4])
+ },
+ [&](const parser::OmpErrorDirective &) {
+ if (!semaCtx.langOptions().OpenMPSimd)
+ TODO(converter.getCurrentLocation(),
+ "OmpErrorDirective");
+ },
+ },
+ dir.u);
}
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
diff --git a/flang/test/Lower/OpenMP/nothing.f90 b/flang/test/Lower/OpenMP/nothing.f90
new file mode 100644
index 0000000000000..775b6a34db45e
--- /dev/null
+++ b/flang/test/Lower/OpenMP/nothing.f90
@@ -0,0 +1,8 @@
+!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 %s -o - | FileCheck %s
+!RUN: bbc -emit-hlfir -fopenmp -fopenmp-version=52 %s -o - | FileCheck %s
+
+! CHECK-LABEL: func @_QPfoo
+subroutine foo
+ ! CHECK-NOT: omp.
+ !$omp nothing
+end subroutine
>From 074d12cd4168bf9baac5285befe4e89165f85d44 Mon Sep 17 00:00:00 2001
From: ShashwathiNavada <shashwathinavada at gmail.com>
Date: Tue, 9 Jun 2026 20:51:27 +0530
Subject: [PATCH 2/2] Update error.f90
---
flang/test/Lower/OpenMP/Todo/error.f90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flang/test/Lower/OpenMP/Todo/error.f90 b/flang/test/Lower/OpenMP/Todo/error.f90
index d002f72760b1c..c8338278a4267 100644
--- a/flang/test/Lower/OpenMP/Todo/error.f90
+++ b/flang/test/Lower/OpenMP/Todo/error.f90
@@ -1,6 +1,6 @@
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
-! CHECK: not yet implemented: OmpUtilityDirective
+! CHECK: not yet implemented: OmpErrorDirective
program p
integer, allocatable :: x
!$omp error at(compilation) severity(warning) message("an error")
More information about the flang-commits
mailing list