[Xenomai-git] Maciej Sumiński : testsuite/cyclictest: silence UMR false-positive with GCC 6.x
Module: xenomai-3 Branch: master Commit: 3fa7c63c33920aa89490ae42538944d81815bf05 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3fa7c63c33920aa89490ae42538944d81815bf05 Author: Maciej Sumiński Date: Fri Dec 2 09:59:00 2016 +0100 testsuite/cyclictest: silence UMR false-positive with GCC 6.x 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; ^~~~ --- 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; } ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Maciej Sumiński : testsuite/cyclictest: silence UMR false-positive with GCC 6.x
Module: xenomai-3 Branch: stable-3.0.x Commit: 3fa7c63c33920aa89490ae42538944d81815bf05 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3fa7c63c33920aa89490ae42538944d81815bf05 Author: Maciej Sumiński Date: Fri Dec 2 09:59:00 2016 +0100 testsuite/cyclictest: silence UMR false-positive with GCC 6.x 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; ^~~~ --- 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; } ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git