Author: Shengxin Pei Date: 2026-07-29T22:24:13+08:00 New Revision: 01891953eea17544f6181bb51c973711a382702b
URL: https://github.com/llvm/llvm-project/commit/01891953eea17544f6181bb51c973711a382702b DIFF: https://github.com/llvm/llvm-project/commit/01891953eea17544f6181bb51c973711a382702b.diff LOG: [Clang][OpenMP] Fixed an assertion on omp taskloop transparent (#200663) In https://github.com/llvm/llvm-project/blob/15bb4a97a798ed43b3966c99d37585651b965e5e/clang/lib/Parse/ParseOpenMP.cpp#L3289-L3295 We missed a check for `WrongDirective` before calling `ActOnOpenMPTransparentClause`. This patch adds the missing check. fix #197162 Added: clang/test/SemaOpenMP/gh197162.c Modified: clang/docs/ReleaseNotes.md clang/lib/Parse/ParseOpenMP.cpp Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md index 0736df269e67a..ac70a35a8b456 100644 --- a/clang/docs/ReleaseNotes.md +++ b/clang/docs/ReleaseNotes.md @@ -361,6 +361,7 @@ features cannot lower the translation-unit ABI level; - Fixed an assertion failure when passing a wide string literal to `__builtin_nan`. (#GH212108) - 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) - Fixed a bug where `__func__`, `__PRETTY_FUNCTION__` and `__FUNCTION__` were not resolving to the proper function when inside a lambda return type (#GH211811) - Fixed USR generation for declarations whose signature mentions a class-type non-type template parameter. (#GH212351) diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 2c65651c49750..dd2dc60a99156 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -3294,8 +3294,9 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind, if (CKind == OMPC_transparent && PP.LookAhead(0).isNot(tok::l_paren)) { SourceLocation Loc = ConsumeToken(); SourceLocation LLoc = Tok.getLocation(); - Clause = Actions.OpenMP().ActOnOpenMPTransparentClause(nullptr, LLoc, - LLoc, Loc); + if (!WrongDirective) + Clause = Actions.OpenMP().ActOnOpenMPTransparentClause(nullptr, LLoc, + LLoc, Loc); break; } if ((CKind == OMPC_ordered || CKind == OMPC_partial) && 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
