[Beignet] [PATCH] libocl: define NULL to zero

Ruiling Song ruiling.song at intel.com
Sun Feb 15 00:18:15 PST 2015


using (void*)0 could not pass compilation in clang 3.6.
It will be treated as private address space pointer, if you compare
a global pointer with NULL, that is a private and global pointer
comparison, this is not allowed by OpenCL spec. But zero is allowed
as it is a pointer and integer comparison.

Detailed discussion, please read:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2015-February/041429.html

Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 backend/src/libocl/include/ocl_types.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backend/src/libocl/include/ocl_types.h b/backend/src/libocl/include/ocl_types.h
index 3b4ce97..487fe68 100644
--- a/backend/src/libocl/include/ocl_types.h
+++ b/backend/src/libocl/include/ocl_types.h
@@ -21,7 +21,7 @@
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 #include "ocl_defines.h"
 
-#define NULL ((void*)0)
+#define NULL 0
 
 /////////////////////////////////////////////////////////////////////////////
 // OpenCL Common Defines
-- 
1.7.10.4



More information about the Beignet mailing list