[PATCH] D38857: [OpenCL] Improve printing and semantic check related to implicit addr space

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 16 10:56:00 PDT 2017


yaxunl marked an inline comment as done.
yaxunl added a comment.

In https://reviews.llvm.org/D38857#896994, @Anastasia wrote:

> LGTM! Thanks!
>
> Can we close https://bugs.llvm.org/show_bug.cgi?id=33418 after this commit?


Will do.



================
Comment at: test/SemaOpenCL/null_literal.cl:38
 
-#ifdef CL20
-// Accept explicitly pointer to generic address space in OpenCL v2.0.
-global int* ptr5 = (generic void*)0;
-#endif
-
-global int* ptr6 = (local void*)0; // expected-error{{initializing '__global int *' with an expression of type '__local void *' changes address space of pointer}}
+  global int *g7 = (global void*)(generic void *)0;
+  constant int *c7 = (constant void*)(generic void *)0; //expected-error{{casting '__generic void *' to type '__constant void *' changes address space of pointer}}
----------------
Anastasia wrote:
> Does this extra cast test anything we already miss to test?
Yes. It tests a generic pointer of zero value can be explicitly casted to a global pointer. This should be true for any generic pointer, however since pointers with zero value have special handling, we want to make sure this still works.


https://reviews.llvm.org/D38857





More information about the cfe-commits mailing list