title: Accessing variable by pointer in OpenCL kernel
body: <p>I am writing a raytracing program in OpenCL and I have a function in my Kernel, Quadratic, that takes in 3 float variables and two pointers to float values.</p>
  
  <p>Function:</p>
  
  <pre><code>bool Quadratic(float A, float B, float C, float *t0, float *t1) {
      float discrim  = B * B - ( 4.0 * A * C );
      if (discrim &lt;= 0.0) return false;
      float rootDiscrim = sqrtf(discrim);
      float q;
      if (B &lt; 0) q = -0.5f * ( B - rootDiscrim);
      else q = -0.5f * ( B + rootDiscrim);
      *t0 = q / A;
      *t1 = C / q;
      float temp;
      return true;
  }
  </code></pre>
  
  <p>Calling the Function:</p>
  
  <pre><code>float t0;
  float t1;
  if (Quadratic(A,  B,  C,  &amp;t0,  &amp;t1)) c[(i*dimy)+j] = t0;
  else c[(i*dimy)+j] =  0.0;
  </code></pre>
  
  <p>Produces the following error:</p>
  
  <pre><code>pyopencl.RuntimeError: clBuildProgram failed: build program failure - 
  Build on &lt;pyopencl.Device 'ATI Radeon HD 6750M' on 'Apple' at 0x1021b00&gt;:
  Error returned by cvms_element_build_from_source
  </code></pre>
  
  <p>In trying to work out what the problem was I created the following test function which seems to work:</p>
  
  <pre><code>bool TestFunc(float Y, float *x) {
      *x = Y;
      return true;
  }
  
  float x;
  if (TestFunc(50.0, &amp;x)) c[(i*dimy)+j] = x;
  </code></pre>
  
  <p>As far as I can see both functions have the same types of inputs and outputs, any help would be greatly appreciated.</p>