[PATCH] D114080: [SYCL] Diagnose uses of zero length arrays

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 17 05:56:49 PST 2021


Fznamznon added a comment.

In D114080#3137430 <https://reviews.llvm.org/D114080#3137430>, @Naghasan wrote:

> Why the need for this restriction ?

Zero length arrays are not supported by pure C++. It is an extension supported by clang. They are also not allowed in OpenCL and SPIR-V, and I even though I cannot grep an explicit restriction for them in SYCL 2020 spec (I guess that is just because it is an extension and not pure C++) It doesn't make sense to allow them here since memory allocation in device code is prohibited in SYCL by the spec. This diagnostic prevents further not always user friendly errors coming from SPIR-V emitters or from backends like OpenCL that explicitly disallow them on early stage and in user-friendly form. I believe other GPU programming models also may not allow them for the same reason - restriction on memory allocation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114080/new/

https://reviews.llvm.org/D114080



More information about the cfe-commits mailing list