|
From: Bart V. A. <bar...@gm...> - 2009-07-25 11:59:51
|
On Sat, Jul 25, 2009 at 12:09 AM, Greg Parker<gp...@ap...> wrote: > On Jul 24, 2009, at 4:28 AM, Bart Van Assche wrote: >> >> When running DRD's regression tests on Darwin, 63 out of 64 regression >> tests always pass and one regression test, rwlock_test, fails >> sometimes. If that test fails it is because DRD reported one or more >> conflicting memory loads triggered by line 35, the statement that >> reads s_counter protected by a reader lock. > > Darwin's pthread_rwlock_init() reads a value from the pthread_rwlock_t > struct before initializing anything. Valgrind doesn't like that. (They say > it's required for Unix compliance; I say it's a bug and the standard > requires no such thing.) With Nick's help I found the source code of the rwlock implementation: http://www.opensource.apple.com/source/Libc/Libc-498.1.7/pthreads/pthread_rwlock.c. The fact that pthread_rwlock_init() reads a value from the pthread_rwlock_t struct is indeed surprising -- this could cause initialization to be skipped for rwlock structures allocated on the stack. Since r10599 all DRD regression tests pass -- the regression test rwlock_test does no longer fail. Thanks for the help. I will now test DRD with larger applications. Bart. |