ANNOTATE_IGNORE_READS_AND_WRITES_END() really works.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10787
static int s_a;
static int s_b;
+static int s_c;
static void* thread_func(void* arg)
{
/* Read s_a and modify s_b. */
s_b = s_a;
+ /* Modify s_c. */
+ s_c = 1;
return NULL;
}
{
int optchar;
int ign_rw = 1;
+ int tmp;
pthread_t tid;
while ((optchar = getopt(argc, argv, "r")) != EOF)
s_a = s_b;
if (ign_rw)
ANNOTATE_IGNORE_READS_AND_WRITES_END();
+
+ /*
+ * Insert a delay here in order to make sure the load of s_c happens
+ * after s_c has been modified.
+ */
+ sleep(1);
+
+ /* Read s_c. */
+ tmp = s_c;
+
pthread_join(tid, 0);
fprintf(stderr, "Finished.\n");
+Conflicting load by thread 1 at 0x........ size 4
+ at 0x........: main (annotate_ignore_rw.c:?)
+Location 0x........ is 0 bytes inside local var "s_c"
+declared at annotate_ignore_rw.c:11, in frame #? of thread 1
+
Finished.
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Location 0x........ is 0 bytes inside local var "s_a"
declared at annotate_ignore_rw.c:9, in frame #? of thread 1
+Conflicting load by thread 1 at 0x........ size 4
+ at 0x........: main (annotate_ignore_rw.c:?)
+Location 0x........ is 0 bytes inside local var "s_c"
+declared at annotate_ignore_rw.c:11, in frame #? of thread 1
+
Finished.
-ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)