[Patch][OpenCL] Custom atomic Builtin check ignores address space of a non-atomic pointer

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 03:23:51 PDT 2015


Hi all,

 

Address spaces are not handled in custom semantic checks of atomic Builtins.

 

If there are two pointers passed to the Builtin, it doesn't allow the second

(non-atomic) one to be qualified with an address space. 

 

This patch removed this restriction by recording the address space of the

passed pointers while checking its type correctness.

 

Currently, the following code:

 

_Atomic int __attribute__((address_space(1))) *A;

int __attribute__((address_space(2))) *B;

...

... = __c11_atomic_compare_exchange_strong(A, B, 1, memory_order_seq_cst,
memory_order_seq_cst);

 

fails to compile with an error: 

 

"passing '__attribute__((address_space(2))) int *' to parameter of type 'int
*' changes address space of pointer".

 

Please, review the attached fix for it!

 

Cheers,

Anastasia

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150930/72ca571e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atom-builtin-addrspace.patch
Type: application/octet-stream
Size: 4285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150930/72ca571e/attachment.obj>


More information about the cfe-commits mailing list