https://github.com/TPPPP72 updated 
https://github.com/llvm/llvm-project/pull/200663

>From b5c6d1f6ca7c8bd651785923b3527e50b2d2b759 Mon Sep 17 00:00:00 2001
From: TPPPP <[email protected]>
Date: Sun, 31 May 2026 23:05:04 +0800
Subject: [PATCH] [Clang][OpenMP] Fixed an assertion on omp taskloop
 transparent

---
 clang/docs/ReleaseNotes.rst      | 1 +
 clang/lib/Sema/SemaOpenMP.cpp    | 5 +++++
 clang/test/SemaOpenMP/gh197162.c | 6 ++++++
 3 files changed, 12 insertions(+)
 create mode 100644 clang/test/SemaOpenMP/gh197162.c

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index fc0a1d2d4c926..cae8238c66138 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -652,6 +652,7 @@ Bug Fixes in This Version
 - Fixed an issue where certain designated initializers would be rejected for 
constexpr variables. (#GH193373)
 - Fixed a crash when ``#embed`` is used with C++ modules (#GH195350)
 - Fixed crash when checking for overflow for unary operator that can't 
overflow (#GH170072)
+- Fixed an assertion on omp taskloop transparent (#GH197162)
 
 Bug Fixes to Compiler Builtins
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 76b40a5039180..50f8438acec08 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -17811,6 +17811,11 @@ OMPClause 
*SemaOpenMP::ActOnOpenMPTransparentClause(Expr *ImpexTypeArg,
                                                     SourceLocation EndLoc) {
   Stmt *HelperValStmt = nullptr;
   OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective();
+
+  if (!isAllowedClauseForDirective(DKind, OMPC_transparent,
+                                   getLangOpts().OpenMP))
+    return nullptr;
+
   OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause(
       DKind, OMPC_transparent, getLangOpts().OpenMP);
   if (CaptureRegion != OMPD_unknown &&
diff --git a/clang/test/SemaOpenMP/gh197162.c b/clang/test/SemaOpenMP/gh197162.c
new file mode 100644
index 0000000000000..42d8d987ac8b4
--- /dev/null
+++ b/clang/test/SemaOpenMP/gh197162.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fopenmp -fsyntax-only %s
+
+void foo() {
+#pragma omp taskloop transparent // expected-error {{unexpected OpenMP clause 
'transparent' in directive '#pragma omp taskloop'}}
+    for(int i = 0; i < 2; i++);
+}

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to