[PATCH] D20090: [OPENCL] Fix wrongly vla error for OpenCL array.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 15 13:27:14 PDT 2020


rsmith added inline comments.


================
Comment at: cfe/trunk/lib/Sema/SemaType.cpp:2067
+                                           S.LangOpts.GNUMode ||
+                                           S.LangOpts.OpenCL).isInvalid();
 }
----------------
This looks wrong to me. The OpenCL rules don't permit arbitrary constant folding in array bounds.

If OpenCL intends to permit reading from const globals of integral types in constant expressions (as C++ does but C does not), then the right way to handle that would be to change `CheckICE` to permit such cases, as it does in C++ mode, not to enable arbitrary constant folding in array bounds.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D20090



More information about the cfe-commits mailing list