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 <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>