cuda-gdb showing Segmentation fault when cuda-memcheck is showing "No Errors"

I am compiling my cuda sample file “add.cu”. It contains 2 set of Data with "array size = 5 ".

~] nvcc -o sam add.cu or ~] nvcc -g -G -o sam add.cu

It creating an executable file with the name of “sam”. After that, I am checking with cuda memcheck.

~]$ cuda-memcheck ./sam
========= CUDA-MEMCHECK
{1,2,3,4,5} + {10,20,30,40,50} = {11,22,33,44,55}
========= ERROR SUMMARY: 0 errors

~]$ ./sam
{1,2,3,4,5} + {10,20,30,40,50} = {11,22,33,44,55}

Then I thought to try it with cuda-gdb.
~]$ cuda-gdb ./sam
Segmentation fault

OR

~]$ cuda-gdb add.cu
Segmentation fault

This is my first cuda-c++ code.

How to get rid of it?

Hi, bbadal

Can you share the source can trigger the issue ?
Or if you want to WAR the issue, you can “set cuda memcheck off” within cuda-gdb