Error on casting uchar to uintX


in a kernel I have this array:

uchar r[2048]

When I try now to cast the array to:

uint *pr = ((uint *)(r + 1792))

It work without problems.

Also this is working:

uchar8 *pr = ((uchar8 *)(r + 1792))

Here I can access .s0, .s1, …

But I get an error when using uintX:

uint8 *pr = ((uint8 *)(r + 1792))

I can only access .s0. On Access .s1 I get the error:

OpenCL Error: CL_OUT_OF_RESOURCES error executing CL_COMMAND_READ_BUFFER on Quadro K4000 (Device 0).


printf((__constant char *)"pr : %X
", *pr.s0);


printf((__constant char *)"pr : %X
", *pr.s1);


printf((__constant char *)"pr : %X %X
", *pr.s0, *pr.s1);

Need the uchar array be defined with an “alignment”?

Fix for this issue:
I defined the array r not as uchar. I defined it as uint8.

Casting “down” from uint8 to uchar is working, “up” from uchar to uint8 not.