[clang] [Clang/AMDGPU] Zero sized arrays not allowed in HIP device code. (PR #113470)

Vigneshwar Jayakumar via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 1 08:08:13 PDT 2024


================
@@ -8714,6 +8714,21 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
     }
   }
 
+  // zero sized static arrays are not allowed in HIP device functions
+  if (LangOpts.CUDAIsDevice && LangOpts.HIP) {
+    if (FunctionDecl *FD = getCurFunctionDecl();
+        FD &&
+        (FD->hasAttr<CUDADeviceAttr>() || FD->hasAttr<CUDAGlobalAttr>())) {
----------------
VigneshwarJ wrote:

Theres one for CUDA, but I didn't see one for LangOpts.HIP.

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


More information about the cfe-commits mailing list