Change the semantics of ANNOTATE_HAPPENS_BEFORE from 'overwrite' to
'add' behaviour, w.r.t. any h-b edges associated with the
synchronisation object prior to the call.  This brings the behaviour
into line with DRD and TSan, and is required for correct annotation of
thread safe reference counting.  It fixes #243935 -- at least, the
original bug as discussed in comments 0 and 2.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11624 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c
index 9f2d503..74f78fb 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -3040,9 +3040,12 @@
    /* TID is just about to notionally sent a message on a notional
       abstract synchronisation object whose identity is given by
       USERTAG.  Bind USERTAG to a real SO if it is not already so
-      bound, and do a 'strong send' on the SO.  This is later used by
+      bound, and do a 'weak send' on the SO.  This joins the vector
+      clocks from this thread into any vector clocks already present
+      in the SO.  The resulting SO vector clocks are later used by
       other thread(s) which successfully 'receive' from the SO,
-      thereby acquiring a dependency on this signalling event. */
+      thereby acquiring a dependency on all the events that have
+      previously signalled on this SO. */
    Thread* thr;
    SO*     so;
 
@@ -3056,7 +3059,7 @@
    so = map_usertag_to_SO_lookup_or_alloc( usertag );
    tl_assert(so);
 
-   libhb_so_send( thr->hbthr, so, True/*strong_send*/ );
+   libhb_so_send( thr->hbthr, so, False/*!strong_send*/ );
 }
 
 static