From: Mathieu Desnoyers Date: Fri, 4 Sep 2015 05:09:39 +0000 (-0400) Subject: Fix: volatile in assert() X-Git-Tag: v0.9.0~43 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=efa8d2c8143de5f4e53bf5ef6f491faf7d7a6bee;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);