BlockIdx.x suddenly jumping to weird, high value

Hi all!

Im having a weird problem with one of my kernels. This seems to happen in emulation mode as well as in device mode (the errormsg here is "unspecified launch failure), but interesting is what I can see when running in emulation:
The first thread runs well, but then suddenly my blockIdx.x jumps up to somewhat in the range of millions so that this thread tries to access something outside of my array (each thread accesses one element of the array). Blockdims are hard-coded inside the <<< >>> and not variable.

Has someone experienced this problem himself or has an idea of what the reason could be?
I have no idea how to get rid of it cause I never have seen anything like this before.
(I didnt post my code cause there isnt anything worthy to mention aside of what i have written in it.)

What are your block/grid dimensions?

gridDim.x = 1849
blockDim.x = 128

blockIdx.x resides in shared memory, so probably one thread is making an out-of-bounds write to shared memory, trashing the variable’s contents

Thx for your hint!
I already solved the problem and it looks like your suggestion was right. It wasnt to find very easily but trashing the block IDs in smem is what is responsible for the strange IDs, I think.

Fantastic catch!