From d7451ee3f07efc5406679d493fcfd05fbaeb5731 Mon Sep 17 00:00:00 2001 From: Marcin Malagowski Date: Mon, 9 Feb 2026 15:10:55 +0200 Subject: [PATCH] Fix Clang compilation errors with VLA initialization Code failed to compile with Clang on following: ``` common.cu(1347): error: variable "initGpuMem" may not be initialized int64_t initGpuMem[nThreads] = {0}; ^ common.cu(1348): error: variable "bufferMemory" may not be initialized int64_t bufferMemory[nThreads] = {0}; ^ 2 errors detected in the compilation of "common.cu". ``` --- src/common.cu | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common.cu b/src/common.cu index f7a3f28..c54684e 100644 --- a/src/common.cu +++ b/src/common.cu @@ -1344,8 +1344,10 @@ testResult_t run() { #if NCCL_VERSION_CODE >= NCCL_VERSION(2,28,0) ncclDevComm devComms[nThreads*nGpus]; #endif - int64_t initGpuMem[nThreads] = {0}; - int64_t bufferMemory[nThreads] = {0}; + int64_t initGpuMem[nThreads]; + int64_t bufferMemory[nThreads]; + memset(initGpuMem, 0, sizeof(initGpuMem)); + memset(bufferMemory, 0, sizeof(bufferMemory)); if (!parallel_init) { // Capture the memory used by the GPUs before initializing the NCCL communicators int64_t* initFreeGpuMem = (int64_t*)calloc(nGpus*3, sizeof(int64_t));