[PATCH] D131024: Fix assert in the call to isOpenMPRebuildMemberExpr

Jennifer Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 2 14:36:46 PDT 2022

jyu2 created this revision.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
jyu2 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

This is to fix https://github.com/llvm/llvm-project/issues/56884

The problem is in isOpenMPRebuildMemberExpr, it is only need to rebuild
for field expression.  No need for member function call.

The fix is to check field for member expression and skip rebuild for member
function call

  rG LLVM Github Monorepo



Index: clang/test/OpenMP/parallel_default_messages.cpp
--- clang/test/OpenMP/parallel_default_messages.cpp
+++ clang/test/OpenMP/parallel_default_messages.cpp
@@ -49,3 +49,10 @@
   return 0;
+class A{
+  void a() {
+    #pragma omp parallel
+    a(b); // expected-error {{use of undeclared identifier 'b'}}
+ }
Index: clang/lib/Sema/SemaOpenMP.cpp
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -2270,6 +2270,9 @@
 bool Sema::isOpenMPRebuildMemberExpr(ValueDecl *D) {
+  // Only rebuild for Field.
+  if (!dyn_cast<FieldDecl>(D))
+    return false;
   DSAStackTy::DSAVarData DVarPrivate = DSAStack->hasDSA(
       [](OpenMPClauseKind C, bool AppliedToPointee,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131024.449443.patch
Type: text/x-patch
Size: 846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220802/6ee14859/attachment.bin>

More information about the cfe-commits mailing list