<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    Hello Ruiling,<br>
    <br>
    As far as I can see, the C spec defines the literal "0" as the null
    pointer, so the following macro seems better:<br>
    <br>
    #define NULL 0<br>
    <br>
    But ignoring the NULL, I think the behaviour might change between
    OpenCL 1.2 and OpenCL 2.0. In CL12, the "void *" is likely to be a
    pointer to the private address space. In that case, the comparison
    is undefined. In CL20, it is likely to be a pointer to the generic
    address space, and it should be allowed by the frontend. (Because
    generic address space includes global address space).<br>
    <br>
    I have to use words like "should" and "likely to" because this needs
    confirmation from language lawyers ... the question actually pushes
    the boundaries of how much I understand the details of OpenCL! :)<br>
    <br>
    Sameer.<br>
    <br>
    <div class="moz-cite-prefix">On 2/13/2015 11:25 AM, Song, Ruiling
      wrote:<br>
    </div>
    <blockquote class=" cite"
id="mid_148B1B7A67D1C24B9EF0BE42EA4977062B7D75D8_SHSMSX101_ccr_corp_intel_com"
cite="mid:148B1B7A67D1C24B9EF0BE42EA4977062B7D75D8@SHSMSX101.ccr.corp.intel.com"
      type="cite">
      <pre wrap="">Hi Sameer, Anastasia,

Do you have any comment on this? Thanks!

Ruiling
</pre>
      <blockquote class=" cite" id="Cite_2351749" type="cite">
        <pre wrap="">-----Original Message-----
From: Song, Ruiling
Sent: Wednesday, February 11, 2015 10:38 AM
To: '<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a>'
Subject: Got compile error 'comparison between non-overlapping address
spaces' on 3.6 branch

I am a developer working on Beignet (OpenCL driver for Intel Graphics card).
I am trying Clang 3.6 branch, and encounter below problem. It works well in
older clang version.
We define NULL as "#define NULL (void *)0", so user could directly use it in
OpenCL language like __kernel void test(__global unsigned int *dst)
        if (dst != NULL) {do something;}
}
But I got below error when compiling using clang 3.6.
"error: comparison between  ('__global unsigned int *' and 'void *') which
are pointers to non-overlapping address spaces"

Is this the expected behavior or a bug?

Thanks!
Ruiling
</pre>
      </blockquote>
    </blockquote>
    <br>
    <br>
  </body>
</html>