Re: linux-next: build warning after merge of the rcu tree
From: Paul E. McKenney
Date: Thu Dec 12 2019 - 01:02:03 EST
On Thu, Dec 12, 2019 at 04:06:22PM +1100, Stephen Rothwell wrote:
> Hi all,
>
> After merging the rcu (I think) tree, today's linux-next build (x86_64
> allnoconfig) produced this warning:
>
> kernel/time/timer.c: In function 'schedule_timeout':
> kernel/time/timer.c:969:20: warning: 'timer.expires' may be used uninitialized in this function [-Wmaybe-uninitialized]
> 969 | long diff = timer->expires - expires;
> | ~~~~~^~~~~~~~~
>
> Introduced by (bisected to) commit
>
> c4127fce1d02 ("timer: Use hlist_unhashed_lockless() in timer_pending()")
>
> x86_64-linux-gnu-gcc (Debian 9.2.1-21) 9.2.1 20191130
Well, if the timer is pending, then ->expires has to have been
initialized, but off where the compiler cannot see it, such as during a
previous call to __mod_timer(). And the change may have made it harder
for the compiler to see all of these relationships, but...
I don't see this warning with gcc version 7.4.0. Just out of curiosity,
what are you running, Stephen?
Eric, any thoughts for properly educating the compiler on this one?
Thanx, Paul