warning: Variable is not live at this point. Returning garbage value??

Hi~~ I got some problem when I’m using cuda-gdb, here is my code.

__device__ static domino_set_key(char *key,int saved_key_len, unsigned char * salt_and_digest)
{
  unsigned char *offset = salt_and_digest+6;
  unsigned char key_digest[DIGEST_SIZE];

  domino_big_md((unsigned char*)key,saved_key_len,key_digest);
...
}
__global__ void domino_crack(unsigned char *glb_salt_and_digest, cipher_binary_struct *cipher_binary, unsigned int *calNum)
{
  ...
  char key[TEST_SIZE] = {'1','2','3','4','5'};
  unsigned char salt_and_digest[40];

  for(int i = 0; i < 40; i++)
  {
    salt_and_digest[i] = glb_salt_and_digest[i];
  }

...
  dominosec_set_key(key,TEST_SIZE,salt_and_digest);
...
}

In the kernel, I set the char array salt_and_digest and key, and pass the pointer to dominosec_set_key,but when I try to print key and salt_and_digest in dominosec_set_key,I got the following error:
warning: Variable is not live at this point. Returning garbage value.
$4 = 0xfffb3000000000 <Address 0xfffb3000000000 out of bounds>

Can someone tell me what might be the reason?
Thank you in advance!

This simply means that variable was optimized out (e.g. it’s value is likely no longer needed and was discarded).

Unfortunately, NVCC has to optimize for memory even in debug builds with -O0 passed to it. One way to retain variable value longer would be to printf its value in the end of the kernel.