diff --git a/openmp/libomptarget/DeviceRTL/include/Configuration.h b/openmp/libomptarget/DeviceRTL/include/Configuration.h --- a/openmp/libomptarget/DeviceRTL/include/Configuration.h +++ b/openmp/libomptarget/DeviceRTL/include/Configuration.h @@ -21,6 +21,7 @@ enum DebugKind : uint32_t { Assertion = 1U << 0, FunctionTracing = 1U << 1, + CommonIssues = 1U << 2, }; /// Return the number of devices in the system, same number as returned on the diff --git a/openmp/libomptarget/DeviceRTL/src/State.cpp b/openmp/libomptarget/DeviceRTL/src/State.cpp --- a/openmp/libomptarget/DeviceRTL/src/State.cpp +++ b/openmp/libomptarget/DeviceRTL/src/State.cpp @@ -162,7 +162,11 @@ } void *memory::allocGlobal(uint64_t Bytes, const char *Reason) { - return malloc(Bytes); + void *Ptr = malloc(Bytes); + if (config::isDebugMode(config::DebugKind::CommonIssues) && + Ptr == nullptr) + PRINT ("Nullptr returned by Malloc!\n"); + return Ptr; } void memory::freeGlobal(void *Ptr, const char *Reason) { free(Ptr); }