[C++0x] contiguous bitfields race implementation

Submitted by Aldy Hernandez on July 28, 2011, 7:12 p.m.

Details

Message ID 4E31B49B.9010704@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez July 28, 2011, 7:12 p.m.
> Yes.  Together with the above it looks then optimal.

Attached patch tested on x86-64 Linux.

OK for mainline?
* expr.c (get_bit_range): Handle *MEM_REF's.

Patch hide | download patch | download mbox

Index: expr.c
===================================================================
--- expr.c	(revision 176824)
+++ expr.c	(working copy)
@@ -4158,7 +4158,10 @@  get_bit_range (unsigned HOST_WIDE_INT *b
 
   /* If other threads can't see this value, no need to restrict stores.  */
   if (ALLOW_STORE_DATA_RACES
-      || (!ptr_deref_may_alias_global_p (innerdecl)
+      || ((TREE_CODE (innerdecl) == MEM_REF ||
+	   TREE_CODE (innerdecl) == TARGET_MEM_REF)
+	  && !ptr_deref_may_alias_global_p (TREE_OPERAND (innerdecl, 0)))
+      || (DECL_P (innerdecl)
 	  && (DECL_THREAD_LOCAL_P (innerdecl)
 	      || !TREE_STATIC (innerdecl))))
     {