Fix code generation, when scalars are used as zero dimensional arrays
Fix code generation, when scalars are used as zero dimensional arrays

Scalars can be used not only to index an array or to store loop
iterators, but also to store data of a calculation. In case this
happens, and this data needs to be referenced they need a special
treatment.

This change makes sure that the code compiles and is correct. It still
copies the scalars into GPU memory and references them by pointer
indirection. This is correct and needed if a scalar is not read-only,
but its value is changed inside the scop and used afterwards. A possible
optimization for read-only scalars is to pass them directly as function
arguments.

Signed-off-by: Tobias Grosser <059b8b880f8441509ec8a65b50b4c6ae74ebea76@grosser.es>
Signed-off-by: Sven Verdoolaege <e5350bbed4977f5eb8ae1dc6abd9ae59d21ace75@kotnet.org>

nicolasvasilache/ppcg,nicolasvasilache/ppcg,Meinersbur/ppcg,Meinersbur/ppcg