This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [cxx-mem-model] Generic atomic functions


On 10/25/2011 02:18 PM, Richard Henderson wrote:
On 10/25/2011 10:20 AM, Andrew MacLeod wrote:
+   /* Otherwise there is a lockfree match, transform the call from:
+        void fn(T* mem, T* desired, T* return, model)
+      into
+        *((In *)return = fn (T* mem, *((In *)desired, model)  */
This is, in general, an aliasing violation nearly guaranteed to fail.
Instead try

*return = VCE<In>(fn(mem, VCE<In>(*desired), model))

where VCE<T>(E) is a VIEW_CONVERT_EXPR with TREE_TYPE = T and a
first operand expression of E.

But in particular, the actual stores and loads happen in the original type.


OK, how's this. (just the c-common.c file)

It seems to work fine. Past all the basic tests, and bootstraps in an incremental bootstrap. I'll kick off a full scratch bootstrap/test before feeling all warm and fuzzy tho :-)

Andrew

Attachment: K
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]