From: Mathieu Desnoyers Date: Fri, 4 Sep 2015 05:09:39 +0000 (-0400) Subject: Fix: volatile in assert() X-Git-Tag: v0.8.8~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0144e9596291c9498b3930ffb94fdd3e7c6374ae;p=urcu.git Fix: volatile in assert() From Coverity: CID 1021642 (#1 of 3): Side effect in assertion (ASSERT_SIDE_EFFECT)assert_side_effect: Argument test_array of assert() has a side effect because the variable is volatile. The containing function might work differently in a non-debug build. Signed-off-by: Mathieu Desnoyers --- diff --git a/tests/benchmark/test_rwlock.c b/tests/benchmark/test_rwlock.c index 6f52e5f..3fad9cf 100644 --- a/tests/benchmark/test_rwlock.c +++ b/tests/benchmark/test_rwlock.c @@ -175,8 +175,11 @@ void *thr_reader(void *_count) } for (;;) { + int a; + pthread_rwlock_rdlock(&lock); - assert(test_array.a == 8); + a = test_array.a; + assert(a == 8); if (caa_unlikely(rduration)) loop_sleep(rduration); pthread_rwlock_unlock(&lock);