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

Stefan Liebler stli@linux.ibm.com
Mon Dec 9 13:00:00 GMT 2019


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



More information about the Libc-alpha mailing list