[PATCH] Get rid of Werror=maybe-uninitialized in clock_nanosleep.c.
Stefan Liebler
stli@linux.ibm.com
Tue Dec 3 08:50:00 GMT 2019
Hi,
If build with -O3 on s390 (31bit) on kernels < 5.1, there are the
following werrors:
../sysdeps/unix/sysv/linux/clock_nanosleep.c:91:12: error: â*((void
*)&trem64+12)â may be used uninitialized in this function
[-Werror=maybe-uninitialized]
*rem = valid_timespec64_to_timespec (trem64);
../include/time.h:264:15: error: âtrem64â may be used uninitialized in
this function [-Werror=maybe-uninitialized]
ts.tv_sec = (time_t) ts64.tv_sec;
This patch moves the calculation of r before the if condition. Then GCC
recognizes that the condition here and in __clock_nanosleep equals and that
trem64 in __clock_nanosleep is initialized.
Bye
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20191202_werror_clock_nanosleep.patch
Type: text/x-patch
Size: 2431 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20191203/fce42234/attachment.bin>
More information about the Libc-alpha
mailing list