[Openmp-commits] [PATCH] D111946: [OpenMP][FIX] Do not dereference a potential nullptr
Johannes Doerfert via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Oct 27 16:18:58 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdc72960967d7: [OpenMP][FIX] Do not dereference a potential nullptr (authored by jdoerfert).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111946/new/
https://reviews.llvm.org/D111946
Files:
openmp/libomptarget/DeviceRTL/src/State.cpp
Index: openmp/libomptarget/DeviceRTL/src/State.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/State.cpp
+++ openmp/libomptarget/DeviceRTL/src/State.cpp
@@ -263,9 +263,9 @@
PreviousThreadState = nullptr;
}
- void init(ThreadStateTy &PreviousTS) {
- ICVState = PreviousTS.ICVState;
- PreviousThreadState = &PreviousTS;
+ void init(ThreadStateTy *PreviousTS) {
+ ICVState = PreviousTS ? PreviousTS->ICVState : TeamState.ICVState;
+ PreviousThreadState = PreviousTS;
}
};
@@ -369,7 +369,7 @@
unsigned TId = mapping::getThreadIdInBlock();
ThreadStateTy *NewThreadState =
static_cast<ThreadStateTy *>(__kmpc_alloc_shared(sizeof(ThreadStateTy)));
- NewThreadState->init(*ThreadStates[TId]);
+ NewThreadState->init(ThreadStates[TId]);
ThreadStates[TId] = NewThreadState;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111946.382842.patch
Type: text/x-patch
Size: 879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211027/76d1c51b/attachment.bin>
More information about the Openmp-commits
mailing list