Skip to content

Conversation

@Ritanya-B-Bharadwaj
Copy link
Contributor

This fixes the issue - #162243 caused by #158134

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:openmp OpenMP related changes to Clang labels Oct 29, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 29, 2025

@llvm/pr-subscribers-clang

Author: None (Ritanya-B-Bharadwaj)

Changes

This fixes the issue - #162243 caused by #158134


Full diff: https://github.com/llvm/llvm-project/pull/165562.diff

1 Files Affected:

  • (modified) clang/lib/Sema/SemaOpenMP.cpp (+1-1)
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 0fa21e89b1236..06b87a4208702 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -3286,7 +3286,7 @@ SemaOpenMP::ActOnOpenMPGroupPrivateDirective(SourceLocation Loc,
                                              ArrayRef<Expr *> VarList) {
   if (!getLangOpts().OpenMP || getLangOpts().OpenMP < 60) {
     Diag(Loc, diag::err_omp_unexpected_directive)
-        << getOpenMPDirectiveName(OMPD_groupprivate, getLangOpts().OpenMP);
+        << 1 << getOpenMPDirectiveName(OMPD_groupprivate, getLangOpts().OpenMP);
     return nullptr;
   }
   if (OMPGroupPrivateDecl *D = CheckOMPGroupPrivateDecl(Loc, VarList)) {

@alexey-bataev
Copy link
Member

Add the test

@@ -8,6 +8,7 @@
#pragma omp groupprivate( // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}}
#pragma omp groupprivate() // expected-error {{expected identifier}}
#pragma omp groupprivate(1) // expected-error {{expected unqualified-id}}
#pragma omp groupprivate(a) // expected-error {{use of undeclared identifier 'a'}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it test the bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The crash was reported for the same line of code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:openmp OpenMP related changes to Clang clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants