Added two additional regression tests.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11095
This commit is contained in:
Bart Van Assche
2010-03-21 17:24:47 +00:00
parent cee53c896b
commit 080f6e814f
7 changed files with 262 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
// Test for ANNOTATE_BENIGN_RACE_STATIC() and ANNOTATE_UNPROTECTED_READ().
#include <pthread.h> /* pthread_create() */
#include <stdio.h> /* fprintf() */
#include "../../drd/drd.h"
/* Local variables. */
static int s_i;
static volatile int s_j;
ANNOTATE_BENIGN_RACE_STATIC(s_i, "Benign because duplicate assignment.");
/* Local functions. */
static void* thread_func(void*)
{
s_i = ANNOTATE_UNPROTECTED_READ(s_j);
return 0;
}
int main(int argc, char** argv)
{
pthread_t tid;
pthread_create(&tid, 0, thread_func, NULL);
s_j++;
s_i = s_j;
pthread_join(tid, NULL);
fprintf(stderr, "Done.\n");
return 0;
}