[clang] [Clang/AMDGPU] Allow zero sized arrays in HIP device code (PR #195716)

Brendon Cahoon via cfe-commits cfe-commits at lists.llvm.org
Tue May 5 13:12:42 PDT 2026


bcahoon wrote:

> > > A zero-size dynamic LDS can also mean just alias of the dynamic LDS buffer and they can just get the same address?
> > 
> > 
> > 0 sized objects are supposed to all get the same address
> 
> Right, so this should be allowed.

Is this what the compiler is doing (if the error message doesn't exist or is removed)?

The prior discussion, in the ticket, is that the zero-size __shared__ array is invalid. If folks are now in agreement that that zero-size __shared__ variables are fine and that the compiler handles them correctly, then I'm ok with removing the error. I think it would be useful to add a warning, though not sure what is the consensus for that?   

https://github.com/llvm/llvm-project/pull/195716


More information about the cfe-commits mailing list