diff --git a/openmp/libomptarget/src/device.cpp b/openmp/libomptarget/src/device.cpp --- a/openmp/libomptarget/src/device.cpp +++ b/openmp/libomptarget/src/device.cpp @@ -305,7 +305,9 @@ DataMapMtx.unlock(); // If not a host pointer and no present modifier, we need to wait for the // event if it exists. - if (!IsHostPtr && !HasPresentModifier) { + // Note: Entry might be nullptr because of zero length array section. + if (Entry != HostDataToTargetListTy::iterator() && !IsHostPtr && + !HasPresentModifier) { Entry->lock(); void *Event = Entry->getEvent(); if (Event) {