https://github.com/TPPPP72 updated https://github.com/llvm/llvm-project/pull/200663
>From b74c8081e0140221695fc0ac81135a5d10fe56ea Mon Sep 17 00:00:00 2001 From: TPPPP <[email protected]> Date: Sun, 31 May 2026 22:44:31 +0800 Subject: [PATCH 1/2] [Clang][OpenMP] Fixed an assertion on omp taskloop transparent --- clang/docs/ReleaseNotes.rst | 1 + clang/lib/Sema/SemaOpenMP.cpp | 4 ++++ clang/test/SemaOpenMP/gh197162.c | 6 ++++++ 3 files changed, 11 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..9b83b719abc0f 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -17811,6 +17811,10 @@ 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..d1e464b838783 --- /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++); +} >From 4059fff2251645f5041427de4974f672acfccde3 Mon Sep 17 00:00:00 2001 From: TPPPP <[email protected]> Date: Sun, 31 May 2026 22:49:23 +0800 Subject: [PATCH 2/2] format --- clang/lib/Sema/SemaOpenMP.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 9b83b719abc0f..50f8438acec08 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -17812,7 +17812,8 @@ OMPClause *SemaOpenMP::ActOnOpenMPTransparentClause(Expr *ImpexTypeArg, Stmt *HelperValStmt = nullptr; OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective(); - if (!isAllowedClauseForDirective(DKind, OMPC_transparent, getLangOpts().OpenMP)) + if (!isAllowedClauseForDirective(DKind, OMPC_transparent, + getLangOpts().OpenMP)) return nullptr; OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause( _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
