Can I use union in __global__ function with indexes?

It doesn’t store the data into:

psw.p[i] = charset[counters[i]];

See this thread.