p = DRD_(rwlock_get)(rwlock);
+ if (p)
+ drd_rwlock_check_type(p, rwlock_type);
+
if (p)
{
const ThreadId vg_tid = VG_(get_running_tid)();
return;
}
+ drd_rwlock_check_type(p, rwlock_type);
+
DRD_(clientobj_remove)(rwlock, ClientRwlock);
}
&GEI);
return;
}
+
+ drd_rwlock_check_type(p, rwlock_type);
+
if (! DRD_(rwlock_is_locked_by)(p, drd_tid))
{
RwlockErrInfo REI = { DRD_(thread_get_running_tid)(), p->a1 };
#include <pthread.h>
#include <stdio.h>
+#include <string.h>
#include "../../config.h"
#include "../../drd/drd.h"
int main(int argc, char** argv)
{
pthread_rwlock_t posix_rwlock;
- int user_defined_rwlock;
+ pthread_rwlock_t user_defined_rwlock;
+ memset(&user_defined_rwlock, 0, sizeof(user_defined_rwlock));
ANNOTATE_RWLOCK_CREATE(&user_defined_rwlock);
pthread_rwlock_init(&posix_rwlock, 0);
- pthread_rwlock_rdlock((pthread_rwlock_t*)&user_defined_rwlock);
+ pthread_rwlock_init((pthread_rwlock_t*)&user_defined_rwlock, 0);
- ANNOTATE_READERLOCK_ACQUIRED(&posix_rwlock);
+ ANNOTATE_READERLOCK_RELEASED(&posix_rwlock);
pthread_rwlock_destroy(&posix_rwlock);
ANNOTATE_RWLOCK_DESTROY(&user_defined_rwlock);
Attempt to use a user-defined rwlock as a POSIX rwlock: rwlock 0x.........
- at 0x........: pthread_rwlock_rdlock* (drd_pthread_intercepts.c:?)
+ at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?)
by 0x........: main (rwlock_type_checking.c:?)
rwlock 0x........ was first observed at:
at 0x........: vgDrdCl_annotate_rwlock (drd.h:?)
rwlock 0x........ was first observed at:
at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?)
by 0x........: main (rwlock_type_checking.c:?)
-
-Destroying locked rwlock: rwlock 0x.........
- at 0x........: pthread_rwlock_destroy* (drd_pthread_intercepts.c:?)
- by 0x........: main (rwlock_type_checking.c:?)
-rwlock 0x........ was first observed at:
- at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?)
- by 0x........: main (rwlock_type_checking.c:?)
-
-Destroying locked rwlock: rwlock 0x.........
- at 0x........: vgDrdCl_annotate_rwlock (drd.h:?)
- by 0x........: main (rwlock_type_checking.c:?)
-rwlock 0x........ was first observed at:
- at 0x........: vgDrdCl_annotate_rwlock (drd.h:?)
- by 0x........: main (rwlock_type_checking.c:?)
Finished.
-ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 4 errors from 2 contexts (suppressed: 0 from 0)