Error: Unaligned memory accesses not supported aligned memory accesses

When compiling, I get the following error: Error: Unaligned memory accesses not supported

__device__  void function()

{

      uint8_t  ib[8], block[8];

     extern __shared__ uint8_t pkt[];

     .... init ... 

     for( i = 1; i < n + 1; i++ )

     {       

    

        ... does stuff here...

       for( j = 0; j < 8; j++ )

        {            

            pkt[iHeader+8*(i-1)+j] = ib[j] ^ block[j]; //unalignment

        }

    }

}

the strange thing is that the following replaced in the code compiles fine:

uint8_t temp = ib[j] ^ block[j];

pkt[iHeader+8*(i-1)+j] = 0; //this is not the same ofcourse

but

uint8_t temp = ib[j] ^ block[j];

pkt[iHeader+8*(i-1)+j] = temp

doesnt work.

Can someone point me toward the sollution or origin of this problem? I have left out alot of code for clearity. Please ask if you need to see more code.

Thanks in advance!

I found a way to avoid the error but i still don’t understand the problem:

i just replaced:

for( j = 0; j < 8; j++ )

       {            

           pkt[iHeader+8*(i-1)+j] = ib[j] ^ block[j]; //unalignment

       }

with

pkt[iHeader+8*(i-1)  ] =ib[0] ^ block[0];

pkt[iHeader+8*(i-1)+1] =ib[1] ^ block[1];

pkt[iHeader+8*(i-1)+2] =ib[2] ^ block[2];

pkt[iHeader+8*(i-1)+3] =ib[3] ^ block[3];

pkt[iHeader+8*(i-1)+4] =ib[4] ^ block[4];

pkt[iHeader+8*(i-1)+5] =ib[5] ^ block[5];

pkt[iHeader+8*(i-1)+6] =ib[6] ^ block[6];	

pkt[iHeader+8*(i-1)+7] =ib[7] ^ block[7];

This still seams to be a problem.
I am uploading a complete example which causes nvcc to fail
bug_371104.cu (19.6 KB)