Fix: volatile in assert()
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 4 Sep 2015 05:09:39 +0000 (01:09 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 4 Sep 2015 05:09:39 +0000 (01:09 -0400)
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 <mathieu.desnoyers@efficios.com>
tests/benchmark/test_rwlock.c

index 6f52e5fc7ef65e2d11376230bbd78604ccb35af8..3fad9cf273bb6300143d2b6e147667aa1752accc 100644 (file)
@@ -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);
This page took 0.033853 seconds and 4 git commands to generate.