diff --git a/source/loader/layers/sanitizer/asan_interceptor.cpp b/source/loader/layers/sanitizer/asan_interceptor.cpp index fc0b312e5f..34d312d134 100644 --- a/source/loader/layers/sanitizer/asan_interceptor.cpp +++ b/source/loader/layers/sanitizer/asan_interceptor.cpp @@ -709,7 +709,9 @@ ur_result_t SanitizerInterceptor::prepareLaunch( // Write debug // We use "uint64_t" here because EnqueueWriteGlobal will fail when it's "uint32_t" - uint64_t Debug = Options(logger).Debug ? 1 : 0; + // Because EnqueueWriteGlobal is a async write, so + // we need to extend its lifetime + static uint64_t Debug = Options(logger).Debug ? 1 : 0; EnqueueWriteGlobal(kSPIR_AsanDebug, &Debug, sizeof(Debug)); // Write shadow memory offset for global memory