https://github.com/TPPPP72 updated https://github.com/llvm/llvm-project/pull/200663
>From c4a9be7ddbd7cc693f0075820d1cc7dabd01279b Mon Sep 17 00:00:00 2001 From: Shengxin Pei <[email protected]> Date: Fri, 24 Jul 2026 17:41:22 +0800 Subject: [PATCH] [Clang][OpenMP] Fixed an assertion on omp taskloop transparent --- clang/docs/ReleaseNotes.md | 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.md b/clang/docs/ReleaseNotes.md index 83a2b10d96046..de7535666f167 100644 --- a/clang/docs/ReleaseNotes.md +++ b/clang/docs/ReleaseNotes.md @@ -338,6 +338,7 @@ features cannot lower the translation-unit ABI level; - Fixed a constraint comparison bug in partial ordering. (#GH182671) - Fixed a rejected-valid case that used an explicit object parameter in an out-of-line definition of a nested class member. (#GH136472) +- 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 5b59eacb3eea8..c07dd23a94af8 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -17926,6 +17926,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..ffdf2ec3c3d8e --- /dev/null +++ b/clang/test/SemaOpenMP/gh197162.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fopenmp -fsyntax-only -verify %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
