[PATCH] D142233: [Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash
Shilei Tian via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 20 11:40:38 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
tianshilei1992 marked an inline comment as done.
Closed by commit rG2ebda47619d7: [Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash (authored by tianshilei1992).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142233/new/
https://reviews.llvm.org/D142233
Files:
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/bug59944.c
Index: clang/test/OpenMP/bug59944.c
===================================================================
--- /dev/null
+++ clang/test/OpenMP/bug59944.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c -triple x86_64-apple-darwin10 %s -o - 2>&1 | FileCheck %s --check-prefix=CHECK
+
+extern int omp_get_initial_device();
+extern void *omp_get_mapped_ptr(void *, int);
+
+void t() {
+ omp_get_mapped_ptr(&x, omp_get_initial_device());
+}
+
+// CHECK: error: use of undeclared identifier 'x'
+// CHECK-NOT: crash
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -7259,7 +7259,7 @@
if (LangOpts.OpenMP >= 51 && CalleeFnDecl->getIdentifier() &&
CalleeFnDecl->getName().startswith_insensitive("omp_")) {
// checking for any calls inside an Order region
- if (Scope->isOpenMPOrderClauseScope())
+ if (Scope && Scope->isOpenMPOrderClauseScope())
Diag(LParenLoc, diag::err_omp_unexpected_call_to_omp_runtime_api);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142233.490927.patch
Type: text/x-patch
Size: 1089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230120/13dc932c/attachment.bin>
More information about the cfe-commits
mailing list