Error without -G option on compilation

I’ve developped a kernel to compute two vector

Here is the kernel:

__global__ void computePQ(double* del, double* G, double* B, double* Q, double* P, double* V, int* i_bus){
	int tid= blockDim.x*blockIdx.x+threadIdx.x;
		for(int i =0; i<*i_bus;i++){
			P[tid]+=V[tid]*V[i]*(G[tid**i_bus+i]*cos( del[tid]-del[i])+B[tid**i_bus+i]*sin( del[tid]-del[i]));
			Q[tid]+=V[tid]*V[i]*(G[tid**i_bus+i]*sin( del[tid]-del[i])-B[tid**i_bus+i]*cos( del[tid]-del[i]));

And when i execute this code without -G, i don’t get the correct value. I’ve read that it could come from the initialization of the variable but P et Q are set to 0 thanks to cudamemset and the other variable are initialize with cudamemcpy.
It could come from a bad synchronisation of the threads in the kernel. but from my point of view, this kernel don’t need __syncthreads because i don’t use the same variable two times? Am i Wrong?

Your chances of getting help would be much improved if you would post a complete, self-contained, buildable and runnable code, together with your compiler command line, and the expected and actual output.

As a first step, make sure you compile for the correct GPU architecture, your program checks the return status of every CUDA API call and kernel launch, and it runs under cuda-memcheck without any errors being reported.