JetBrains Rider 2026.3 Help

Code inspection: A '__shared__' variable cannot have an initializer

This inspection reports an initializer on a __shared__ variable. CUDA does not initialize shared memory when the variable is declared. If you need an initial value, assign it after the declaration.

Example

__global__ void kernel() { __shared__ int value = 0; }
__global__ void kernel() { __shared__ int value; value = 0; }
27 October 2026