This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Get rid of Werror=maybe-uninitialized in clock_nanosleep.c.


On 12/9/19 1:59 PM, Stefan Liebler wrote:
On 12/3/19 9:50 AM, Stefan Liebler wrote:
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

ping

ping


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]