I noticed that calling the printf function (with cl_intel_printf extension), the same variable of type double (8-byte aligned) printed multiple times gives different values; one of them is correct, the other one bogus (reading 4 bytes off). Does it mean that, as in c/c++, aligned datatypes should not be passed by value, but only by pointers (or by reference in c++)?
(More generally, what is the function caling convention for OpenCL? I read somewhere that all function calls are inlined, but OpenCL in Action speaks otherwise. Is that implementation-defined?)
The problem was caused by specifying
%ginstead of%lgfor the double arguments to printf. With%g, some values were not printed correctly. (The compiler does not seem to have printf-syntax checker.)