1 // Test for ANNOTATE_BENIGN_RACE_STATIC() and ANNOTATE_UNPROTECTED_READ().
4 #include <pthread.h> /* pthread_create() */
5 #include <stdio.h> /* fprintf() */
6 #include "../../drd/drd.h"
12 static volatile int s_j
;
14 ANNOTATE_BENIGN_RACE_STATIC(s_i
, "Benign because duplicate assignment.");
17 /* Local functions. */
19 static inline void AnnotateIgnoreReadsBegin() { ANNOTATE_IGNORE_READS_BEGIN(); }
20 static inline void AnnotateIgnoreReadsEnd() { ANNOTATE_IGNORE_READS_END(); }
22 static void* thread_func(void*)
24 #if defined(__powerpc__) && __GNUC__ -0 == 4 && __GNUC_MINOR__ -0 == 3 \
25 && __GNUC_PATCHLEVEL__ -0 == 0
26 AnnotateIgnoreReadsBegin();
28 AnnotateIgnoreReadsEnd();
31 s_i
= ANNOTATE_UNPROTECTED_READ(s_j
);
36 int main(int argc
, char** argv
)
40 pthread_create(&tid
, 0, thread_func
, NULL
);
43 pthread_join(tid
, NULL
);
45 fprintf(stderr
, "Done.\n");