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

Erik Schnetter schnetter at gmail.com
Thu Aug 29 08:42:26 PDT 2013


The OpenCL C language requires that sizeof(long)=8, independent of the architecture. This is not what Clang currently implements.

How would I change this in clang? This issue is currently preventing supporting the "long" and (as a consequence) "double" type for 32-bit architectures in pocl <http://pocl.sourceforge.net/>.

I see that the file lib/Basic/TargetInfo.cpp defines e.g. "LongWidth = LongAlign = 32;". It seems that this definition should depend on the language chosen (-x cl) -- would this be the correct approach? What about all the targets that inherit from TargetInfo -- should they also receive the corresponding modification? How do I determine the current language in Clang?

Or would it be better to override these values after the TargetInfo object has been created? Is there already a language hook for this?

Any pointers, suggestions, or ideas for this would be appreciated.

-erik

-- 
Erik Schnetter <schnetter at gmail.com>
http://www.perimeterinstitute.ca/personal/eschnetter/

My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://pgp.mit.edu/.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130829/3706a5ad/attachment.sig>


More information about the cfe-dev mailing list