In the DIFFX function, the parameter:
__local float *IN
__local float **IN
__local float *IN[LS] (you have to move the #define LS higher in your code)
The compiler still warns for both of these(not sure why), but the code compiles. You might be better off defining UinLOC as one-dimensional:
__local float UinLOC[ (LS+2) * LS ];
and computing the addresses as:
OUT = IN[ (4*XL + i + 2 ) * LS + YL ] - IN[ (4*XL + i) * LS + YL ];
The first way compiles, but it gives me wrong numbers.
The second way is to hard, cause i must change many lines of code, so i think i will use the easy known way.
I think the problem is that you're trying to use 2D indexing from a pointer type. To use 2D array, you have to know how many elements are in the leading dimension. While Fortran passes this information off to functions behind the scenes, C (and hence OpenCL) does not. As such, you'll need to explicitly pass the leading dimension of UinLoc to DIFFX() in another parameter and a 1D array lookup. Since C is row-major, DIFFX should look up values as
OUT=IN[4*XL+i+2 + YL*ld] - IN[4XL + i + YL*ld];
where ld is the leading dimension parameter you need to add to DIFFX. ld in this case is 4, since array dimensions go from right to left.
Generally I've always advised people against pretending that C has 2D arrays in their code. Invariable it wrecks code maintenance because of all the sizes you have to pass statically to things, or if you pass a ** you still need the size anyway. Generally I'd stick with 1D arrays and sizes in code like this, it's less messy if you always do it that way and more flexible.