Indexing several shared memory variables

I want to use more than one variable stored in shared memory, I remember reading something about that different variables in shared memory actually are the same pointer, is this still true?

If I for example use

shared float s_1[32];
shared float s_2[32];

do I need to index s_2 as s_2[32 + i] instead of s_2[i] ?

No. What you are recalling applies to dynamically allocated shared memory.

Ah you’re right, but I still have to do indexing like that for dynamically allocated shared memory?

Yes, but you can set multiple local variables pointing to shared memory in the top of your kernel like this:

int *sh1 = (int *)&shared[0];

int *sh2 = (int *)&shared[n * sizeof(int)];