57 lines
2.1 KiB
Diff
57 lines
2.1 KiB
Diff
|
From 3fa7c63c33920aa89490ae42538944d81815bf05 Mon Sep 17 00:00:00 2001
|
|||
|
From: =?UTF-8?q?Maciej=20Sumi=C5=84ski?= <maciej.suminski@cern.ch>
|
|||
|
Date: Fri, 2 Dec 2016 09:59:00 +0100
|
|||
|
Subject: [PATCH] testsuite/cyclictest: silence UMR false-positive with GCC 6.x
|
|||
|
MIME-Version: 1.0
|
|||
|
Content-Type: text/plain; charset=UTF-8
|
|||
|
Content-Transfer-Encoding: 8bit
|
|||
|
|
|||
|
cyclictest.c: In function ‘timerthread’:
|
|||
|
cyclictest.c:347:30: error: ‘*((void *)&stop+8)’ may be used
|
|||
|
uninitialized in this function [-Werror=maybe-uninitialized]
|
|||
|
diff += ((int) t1.tv_nsec - (int) t2.tv_nsec) / 1000;
|
|||
|
^~~~~~~~~~~~~~~~
|
|||
|
cyclictest.c:760:39: note: ‘*((void *)&stop+8)’ was declared here
|
|||
|
struct timespec now, next, interval, stop;
|
|||
|
^~~~
|
|||
|
cyclictest.c:346:54: error: ‘stop.tv_sec’ may be used uninitialized in
|
|||
|
this function [-Werror=maybe-uninitialized]
|
|||
|
diff = USEC_PER_SEC * (long long)((int) t1.tv_sec - (int) t2.tv_sec);
|
|||
|
^~~~~~~~~~~~~~~
|
|||
|
cyclictest.c:760:39: note: ‘stop.tv_sec’ was declared here
|
|||
|
struct timespec now, next, interval, stop;
|
|||
|
^~~~
|
|||
|
[Thomas: needed to fix a gcc 6.x build failure.]
|
|||
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|||
|
---
|
|||
|
demo/posix/cyclictest/cyclictest.c | 5 +++--
|
|||
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|||
|
|
|||
|
diff --git a/demo/posix/cyclictest/cyclictest.c b/demo/posix/cyclictest/cyclictest.c
|
|||
|
index 3bb4386..31d9e5d 100644
|
|||
|
--- a/demo/posix/cyclictest/cyclictest.c
|
|||
|
+++ b/demo/posix/cyclictest/cyclictest.c
|
|||
|
@@ -734,7 +734,7 @@ static inline void barrier_wait(struct thread_barrier *barrier)
|
|||
|
while (barrier->count > 0)
|
|||
|
pthread_cond_wait(&barrier->wait, &barrier->lock);
|
|||
|
}
|
|||
|
-
|
|||
|
+
|
|||
|
pthread_mutex_unlock(&barrier->lock);
|
|||
|
}
|
|||
|
|
|||
|
@@ -832,8 +832,9 @@ void *timerthread(void *param)
|
|||
|
next.tv_nsec += interval.tv_nsec;
|
|||
|
tsnorm(&next);
|
|||
|
|
|||
|
+ memset(&stop, 0, sizeof(stop)); /* grrr */
|
|||
|
+
|
|||
|
if (duration) {
|
|||
|
- memset(&stop, 0, sizeof(stop)); /* grrr */
|
|||
|
stop = now;
|
|||
|
stop.tv_sec += duration;
|
|||
|
}
|
|||
|
--
|
|||
|
2.7.4
|
|||
|
|