[cfe-dev] sizeof(long) in OpenCL C

Michele Scandale michele.scandale at gmail.com
Fri Aug 30 11:08:12 PDT 2013


On 08/30/2013 07:00 PM, David Tweed wrote:
> Hi,
>
> | I notice that, with the patch applied, "long" has 64 bits, but
> __INTPTR_TYPE__ is still defined as "long int" on ARM. This is now wrong; it
> needs to be set to "int" instead. Do you have pointers for
> | correcting this in clang?
>
> Unfortunately not; implementation (even such simple things as choice of
> size) of pointers for OpenCL devices is one of those "implementations may
> make different choices" areas where things don't map cleanly to the standard
> clang front-end.

Uhm.. Implementation defined types makes type size enforcing complex. If the 
mapping must be direct I think there is no solution.

If the relationship is just between implementation defined type and (sign, 
bitwidth) then the mapping can be done on the fly looking for the pair (sign, 
bitwidth) in the native types map, picking a compatible type.
The fact that there is no direct control on the mapping can be an issue.

-Michele



More information about the cfe-dev mailing list