FW: [Patch] Bugfix for pointer address space in atomic builtins

Anastasia Stulova anastasia.stulova at arm.com
Thu Feb 26 03:09:41 PST 2015


Hi Matt,

 

Thanks for your comments. 

 

> I think this needs a test that includes checking the emitted IR.



No problem. I will add that!


> Would it be reasonable to fix this more generally for all builtins? I know
this is a problem for many others that accept pointers

 


This fix is not specific to c11 compare exchange atomic, but to atomics with
a pointer as second parameter. Do you mean generalization for other
parameters here? Could you tell me what atomic functions should I be looking
at?

Anastasia






From: cfe-commits-bounces at cs.uiuc.edu
[mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of Anastasia Stulova
Sent: 12 February 2015 18:01
To: cfe-commits at cs.uiuc.edu
Subject: [Patch] Bugfix for pointer address space in atomic builtins

 

Address spaces are not handled in atomic buildins sematic checks. If there
are two pointers passed to the builtin, it requires them to be in the same
address space. That is unnecessary restriction.

 

This patch removed this restriction by copying the address space from the
passed pointers into checked type.

 

Currently, the following code:

 

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

int *B;

...

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

 

fails to compile with an assertion, because A and B are expected to be in
the same address space. This is not really necessary, as they are just two
pointers pointed to separate objects used in the atomic operation.

 

Looking forward to your feedback,

Anastasia






_______________________________________________
cfe-commits mailing list
cfe-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150226/b219456d/attachment.html>


More information about the cfe-commits mailing list