title: CUDA memory troubles
body: <p>I have a CUDA kernel which I'm compiling to a cubin file without any special flags:</p>
  
  <pre><code>nvcc text.cu -cubin
  </code></pre>
  
  <p>It compiles, though with this message:</p>
  
  <blockquote>
    <p>Advisory: Cannot tell what pointer points to, assuming global memory space</p>
  </blockquote>
  
  <p>and a reference to a line in some temporary cpp file. I can get this to work by commenting out some seemingly arbitrary code which makes no sense to me.</p>
  
  <p>The kernel is as follows:</p>
  
  <pre><code>__global__ void string_search(char** texts, int* lengths, char* symbol, int* matches, int symbolLength)
  {
      int localMatches = 0;
      int blockId = blockIdx.x + blockIdx.y * gridDim.x;
      int threadId = threadIdx.x + threadIdx.y * blockDim.x;
      int blockThreads = blockDim.x * blockDim.y;
  
      __shared__ int localMatchCounts[32];
  
      bool breaking = false;
      for(int i = 0; i &lt; (lengths[blockId] - (symbolLength - 1)); i += blockThreads)
      {
          if(texts[blockId][i] == symbol[0])
          {
              for(int j = 1; j &lt; symbolLength; j++)
              {
                  if(texts[blockId][i + j] != symbol[j])
                  {
                      breaking = true;
                      break;
                  }
              }
              if (breaking) continue;
              localMatches++;
          }
      }
  
      localMatchCounts[threadId] = localMatches;
  
      __syncthreads();
  
      if(threadId == 0)
      {
          int sum = 0;
          for(int i = 0; i &lt; 32; i++)
          {
              sum += localMatchCounts[i];
          }
          matches[blockId] = sum;
      }
  }
  </code></pre>
  
  <p>If I replace the line</p>
  
  <pre><code>localMatchCounts[threadId] = localMatches;
  </code></pre>
  
  <p>after the first for loop with this line</p>
  
  <pre><code>localMatchCounts[threadId] = 5;
  </code></pre>
  
  <p>it compiles with no notices. This can also be achieved by commenting out seemingly random parts of the loop above the line. I have also tried replacing the local memory array with a normal array to no effect. Can anyone tell me what the problem is?</p>
  
  <p>The system is Vista 64bit, for what its worth.</p>
  
  <p>Edit: I fixed the code so it actually works, though it still produces the compiler notice. It does not seem as though the warning is a problem, at least with regards to correctness (it might affect performance).</p>